HDU 1165 Eddy's research II(给出递归公式,然后找规律)
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
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
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
Sample Input
2 4
Sample Output
11
#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(给出递归公式,然后找规律)的更多相关文章
- HDU 1165 Eddy's research II
题意:已知,求A(m, n). 分析:根据样例模拟一下过程就可以找出递推关系. #include<cstdio> #include<cstring> #include<c ...
- HDU 1165 Eddy's research II (找规律)
题意:给定一个表达式,然后让你求表达式的值. 析:多写几个就会发现规律. 代码如下: #pragma comment(linker, "/STACK:1024000000,102400000 ...
- hdu 1165 Eddy's research II(数学题,递推)
// Eddy 继续 Problem Description As is known, Ackermann function plays an important role in the sphere ...
- HDU1165: Eddy's research II(递推)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1165 果断不擅长找规律啊,做这种题静不下心来. Ackermann function can be def ...
- hdu 1164:Eddy's research I(水题,数学题,筛法)
Eddy's research I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- hdu 3032 Nim or not Nim? (SG函数博弈+打表找规律)
Nim or not Nim? Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Sub ...
- hdu 1164 Eddy's research I
http://acm.hdu.edu.cn/showproblem.php?pid=1164 题意很简单,只是写代码的时候需要注意几个问题 一.筛选素数的时候记得用埃式筛选法,要是直接找可能会WA. ...
- HDU 1164 Eddy's research I( 试除法 & 筛法改造试除法 分解整数 )
链接:传送门 题意:给出一个整数 n ,输出整数 n 的分解成若干个素因子的方案 思路:经典的整数分解题目,这里采用试除法 和 用筛法改造后的试除法 对正整数 n 进行分解 方法一:试除法对正整数 n ...
- HDU 1164 Eddy's research I
题目链接 题意 : 给你一个数,让你用它的素数质因子表示出来. 思路 : 先打一下表,因为会有重复的质因子,所以从大到小开始找,并且找到一个之后不能就接着往下找,要再找一遍这个数. #include ...
随机推荐
- 解决全站字符乱码(POST和GET中文编码问题)
1 说明 乱码问题: 获取请求参数中的乱码问题: POST请求:request.setCharacterEncoding(“utf-8”): GET请求:new String(request.getP ...
- 洛谷P4717 【模板】快速沃尔什变换(FWT)
题意 题目链接 Sol 背板子背板子 #include<bits/stdc++.h> using namespace std; const int MAXN = (1 << 1 ...
- Spring的大框架
初识Spring: Spring作者:Rod Johnson Spring框架由20个模块组成,这些模块分成六个部分,分别是Core Container,Data Access/Integration ...
- Unable to update index for central http://repo1.maven.org/maven2/ 解决方法
不知道什么原因 MyEclipse(eclipse) 中的 maven 插件突然不能用了,修改 pom.xml 无任何反应 控制台报 Unable to update index for centra ...
- 【JavaScript】闭包应用之数据缓存
最近的开发中的许多事件会被频繁的触发,由于没有做缓存的处理,每次事件触发都会后台调用一样的数据.这几天我突然意识到自己的代码有很大的优化空间,继而想起了闭包可以有缓存的功能,于是乎便对其进行了深入的研 ...
- C#中Equals和= =(等于号)的比较(转)
一. 值类型的比较 对于值类型来说 两者比较的都是”内容”是否相同,即 值 是否一样,很显然此时两者是划等号的. 例: int i = 9; int j = 9; Console ...
- 构建微软智能云:介绍新的Azure业务转型创新技术
在我和用户的交流中发现,在任何类型和规模的组织中,每当涉及到在云中实现商业价值的最大化并取得竞争优势的时候,就会明显呈现三个趋势.首先,应用程序促进着组织更快速实现价值.同时,诸如机器学习.数据预测分 ...
- BigDecimal setScale()设置无效 scale()取得的值不是setScale()设置的值
最近查看rebate数据时,发现一个bug,主要现象是,当扣款支付宝的账号款项时,返回的是数字的金额为元,而数据库把金额存储为分,这中间要做元与分的转化,这个转化规则很简单,就是*100的,所以一开始 ...
- HTML学习---基础知识学习
1.1. HTML 1.为什么要有HTML? "Hello" "<h1>Hello</h1>" - 浏览器渲染时使用一套HTML规则, ...
- centos6.3_gcc安装软件及流程
分享链接下载文件上传安装即可 链接:https://pan.baidu.com/s/15eUhm9LTUdHDPkXOyRb9Tg 密码:tohr # 文件内置安装脚本,直接安装即可 [root@lo ...