- 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. 在IIS中部署好WCF服务站点后,本机访问服务无问题,局域网中其他电脑访问不到

    1.问题描述 在IIS中部署好WCF服务站点后,本机访问服务无问题,局域网中其他电脑访问不到. 2.解决方法 (1)控制面板 -> Windows防火墙 -> 高级设置 (2)属性 (3) ...

  2. 【C++并发实战】(二)线程管理

    前一篇没用markdown编辑器感觉不好看,删了重新发 本篇主要讲述线程的管理,主要包括创建和使用线程 启动线程 线程出现是为了执行任务,线程创建时会给一个入口函数,当这个函数返回时,该线程就会退出, ...

  3. UNIX 网络编程笔记-CH2:TCP、UDP概貌

    好久不读不用又忘得差不多了,还是感叹Richard Stevens真是太刁,25年前第一版. "Tcp state diagram fixed new" by Scil100. L ...

  4. Bootstrap网格

    首先了解一下,什么是网格? 在平面设计中,网格是一种由一系列用于组织内容的相交的直线(垂直的.水平的)组成的结构(通常是二维的).它广泛应用于打印设计中的设计布局和内容结构.在网页设计中,它是一种用于 ...

  5. h5的classList对象

    H5新增属性classList h5中新增了一个classList,原生js可以通过它来判断获取dom节点有无某个class. classList是html元素对象的成员,它的使用非常简单,比如 co ...

  6. Signal & Slot in Qt

    Try your best to provide an mechanism to implement what you want. 1. All is generated by QT Framewor ...

  7. zabbix共享内存报错cannot create semaphore set

    zabbix共享内存报错 cannot open log: cannot create semaphore set: [28] No space left on device 报错原因: kernel ...

  8. Linux(CentOS)网卡的基本设置

    临时设置 修改IP地址: ifconfig eth0 10.60.45.205 mask 255.255.255.0 修改网关地址 route add default gw 10.60.45.1 de ...

  9. oracle sql练习 菜鸟入门!

    进入公司 ,首先是进行SQL培训 一下是针对oracle的emp与dept表进行的基础查询 --1.选择部门30中的所有员工: ; --2.列出所有办事员(CLERK)的姓名,编号和部门编号: sel ...

  10. java.lang.UnsatisfiedLinkError: /usr/openv/java/jre/lib/amd64/libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory

    解决办法: 在radhat 或者centos系统中运行一下命令即可:yum install libXext.x86_64yum install libXrender.x86_64yum install ...