- Eddy's research II

Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

As is known, Ackermann function plays an important role in the sphere of theoretical computer science. However, in the other hand, the dramatic fast increasing pace of the function caused the value of Ackermann function hard to calcuate.

Ackermann function can be defined recursively as follows:

Now Eddy Gives you two numbers: m and n, your task is to compute the value of A(m,n) .This is so easy problem,If you slove this problem,you will receive a prize(Eddy will invite you to hdu restaurant to have supper).

 

Input

Each line of the input will have two integers, namely m, n, where 0 < m < =3.

Note that when m<3, n can be any integer less than 1000000, while m=3, the value of n is restricted within 24.

Input is terminated by end of file.
 

Output

For each value of m,n, print out the value of A(m,n).
 

Sample Input

1 3
2 4
 

Sample Output

5
11
 
分析:
告诉你m<=3,所以我们应该往这方面靠
看看m不同,是不是有不同的n的公式
纯粹找规律
 
。。。。。
根据递推公式
记忆化搜一下
打印m不同值 n相同值的结果出来
然后找规律。。。。
code:
#include <iostream>
#include <cstdio>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<memory>
#include<queue>
#include<vector>
using namespace std;
int f(int n)
{
int s=;
for(int i=;i<=n;i++)
{
s=s*;
}
return s;
}
int slove(int m,int n)
{
if(m==)
return n+;
if(m==)
return n+;
if(m==)
return *n+;
if(m==)
return f(n+)-;
}
int main()
{
int n,m;
while(~scanf("%d %d",&m,&n))
{
printf("%d\n",slove(m,n));
}
return ;
}

HDU 1165 Eddy's research II(给出递归公式,然后找规律)的更多相关文章

  1. HDU 1165 Eddy's research II

    题意:已知,求A(m, n). 分析:根据样例模拟一下过程就可以找出递推关系. #include<cstdio> #include<cstring> #include<c ...

  2. HDU 1165 Eddy's research II (找规律)

    题意:给定一个表达式,然后让你求表达式的值. 析:多写几个就会发现规律. 代码如下: #pragma comment(linker, "/STACK:1024000000,102400000 ...

  3. hdu 1165 Eddy&#39;s research II(数学题,递推)

    // Eddy 继续 Problem Description As is known, Ackermann function plays an important role in the sphere ...

  4. HDU1165: Eddy's research II(递推)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1165 果断不擅长找规律啊,做这种题静不下心来. Ackermann function can be def ...

  5. hdu 1164:Eddy's research I(水题,数学题,筛法)

    Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  6. hdu 3032 Nim or not Nim? (SG函数博弈+打表找规律)

    Nim or not Nim? Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Sub ...

  7. hdu 1164 Eddy's research I

    http://acm.hdu.edu.cn/showproblem.php?pid=1164 题意很简单,只是写代码的时候需要注意几个问题 一.筛选素数的时候记得用埃式筛选法,要是直接找可能会WA. ...

  8. HDU 1164 Eddy's research I( 试除法 & 筛法改造试除法 分解整数 )

    链接:传送门 题意:给出一个整数 n ,输出整数 n 的分解成若干个素因子的方案 思路:经典的整数分解题目,这里采用试除法 和 用筛法改造后的试除法 对正整数 n 进行分解 方法一:试除法对正整数 n ...

  9. HDU 1164 Eddy's research I

    题目链接 题意 : 给你一个数,让你用它的素数质因子表示出来. 思路 : 先打一下表,因为会有重复的质因子,所以从大到小开始找,并且找到一个之后不能就接着往下找,要再找一遍这个数. #include ...

随机推荐

  1. 关于mysql的 sql_mode=only_full_group_by 报错

    在mysql中执行 : SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); 官网:https://dev ...

  2. 简易搭建git仓库、关联远程和本地仓库方法。克隆仓库方法。同一台电脑上创建两个git ssh key方法。

    一,在github上建仓库 react-js-antd-demo: 二:将远程仓库与本地仓库关联 git remote add origin git@github.com:begin256/react ...

  3. bootstrap学习笔记(菜单.按钮)

    下拉菜单 <div class="dropdown"> <button class="btn btn-default dropdown-toggle&q ...

  4. Spring Data MongoDB 分页查询

    在上篇文章 Spring Data MongoDB 环境搭建 基础上进行分页查询 定义公用分页参数类,实现 Pageable 接口 import java.io.Serializable; impor ...

  5. GoJs实现流程管理图

    GoJS是一个实现交互类图表(比如流程图,树图,关系图,力导图等等)的JS库. 可以加入诸多功能.如流程判断,节点处理等等.GOJS在设计上极大的减轻了开发人员的开发成本.

  6. C++学习笔记(5)----重载自增自减运算符

    自增运算符“++”和自减运算符“--”分别包含两个版本.即运算符前置形式(如 ++x)和运算符后置形式(如 x++),这两者进行的操作是不一样的.因此,当我们在对这两个运算符进行重载时,就必须区分前置 ...

  7. 图片裁剪(基于RxPaparazzo)

    图片裁剪(基于RxPaparazzo) 前言:基于RxPaparazzo的图片裁剪,图片旋转.比例放大|缩小. 效果: 开发环境:AndroidStudio2.2.1+gradle-2.14.1 涉及 ...

  8. 一、angularjs基础了解

    说明:此处比较杂,目前没有统一的总结哦 angularjs 是mvvm框架 加载JS文件总是使用后缀为.min.js的文件,因为这些文件是经过压缩的,能提升应用的启动速度 模块说明: 1.config ...

  9. Linux常用命令(一)————查找和替换

    1. 查找一个字符串 一个字符串是一行上的一个或几个字符.    为查找一个字符串,在vi命令模式下键入“/”,后面跟要查找的字符串,再按回车.vi将光标定位在该串下一次出现的地方上.键入n跳到该串的 ...

  10. 【转】snmpwalk常用用法

    在日常监控中,经常会用到snmp服务,而snmpwalk命令则是测试系统各种信息最有效的方法,现总结一些常用的方法如下: 1.snmpwalk -v 2c -c public 10.103.33.1 ...