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 ...
随机推荐
- Redis实现分布式锁2
redisTemplate实现分布式锁 /** * 分布式锁-加锁 * @param key * @param value 当前时间+超时时间 System.currentTimeMillis()+t ...
- js delete 操作符
delete操作符很陌生,很少会用到,但是既然碰到了,就mark一下: delete 操作符用于删除一个对象的属性: 注意点:只能删除自己的属性,从原型链上继承的属性是无法删除的:
- CentOS6.5(2)----安装Tab键自动补全功能:bash-completion
首先要确保网络畅通,因为该过程要通过网络下载相关的软件包. 在 root 用户下,使用 cd ~/Downloads 命令进入下载文件夹,然后依次输入如下三个命令: [root@prime:~/Doc ...
- Visual Studio 2015 安装笔记
- 工具Sequel Pro简介
从图中可以看到,sequel工作界面主要分成三部分,左边侧边显示的是当前所连接的数据库中存在的数据表,右侧上半部分则是用于写sql的地方,在Mac环境下按command+R键会执行你所写的sql,右侧 ...
- Linux下部署redis以及相关简介
什么是redis? Redis是一个高性能的key-value数据库.key-value分布式存储系统查询速度快.存放数据量大.支持高并发,非常适合通过主键进行查询,但不能进行复杂的条件查询.key ...
- sql语句 查询分组后的每组的第一条或最后一条数据
select * from(select row_number() over(partition by IDCARD order by DATATM desc) as rownum,* from (S ...
- 译文 [ROM][多国语言][2015.06.11] Lenovo S750 (MTK6589) - andrea_d86-lenovos750-4.2.2
************************************************** andrea_d86-lenovos750-4.2.2-150530 ************** ...
- 最近选购MP3而有感便携追求音质的一些心得
之前的创新小石头MP3的耳机接口松动了.考虑到它已经服役了4年了.所以我准备重新买一个.而小石头出色的外放,我决定让给宝宝当玩具. 选购心得MP3的时候,原来的主导思想,是在低价位的里面考虑一台国际品 ...
- 安装Xcode主题
安装Xcode主题 下载地址 https://github.com/YouXianMing/Xcode-Themes 安装教程 1. 安装文件夹中的字体 2. 如下图,执行 ./cp_themes.s ...