hdu1995-递推
来源:互联网 发布:青苹果申报数据库 编辑:程序博客网 时间:2024/06/12 08:17
https://vjudge.net/problem/HDU-1995
当盘子数为n时,盘子k的移动次数。
手算一下情况。
当有两个时 分别为 1 2(分别为2 号和1号)
3时 1 2 4
发现了递推的规律。
如果天下的递推都这么简单就好了qwq
#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>using namespace std;int main(){ long long sum; int t; int m,n; scanf("%d",&t); while(t--){ scanf("%d%d",&m,&n); sum=(long long )pow(2,m-n); printf("%lld\n",sum); } return 0;}
阅读全文
0 0
- hdu1995-递推
- HDU1995 汉诺塔V 【递推】
- hdu1995
- HDU1995:汉诺塔V
- hdu1995汉诺塔V
- hdu1995汉诺塔V
- hdu1995汉诺塔V
- hdu1995--汉诺塔V
- HDU1995-汉诺塔V
- HDU1995 汉诺塔5
- hdu1995 汉诺塔V
- Hdu1995汉诺塔V
- 递推
- 递推
- 递推
- 递推
- 递推
- 递推
- Performance Measure of Algorithms(1)--Mathematical Background
- centos7的配置
- Java编程的整理
- 阻塞队列
- B -Escape CodeForces
- hdu1995-递推
- 还是畅通工程
- android studio logcat 中文乱码解决
- 2017四川省赛总结
- Centos7 防火墙使用
- NLTK学习笔记(二):文本、语料资源和WordNet汇总
- Flex中的ViewStack
- php学习笔记1——php基础
- evaluate-reverse-polish-notation