HDU 1995 汉诺塔V (水题)
题意:。。
析:2^n-i
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#define debug() puts("++++");
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 40 + 5;
const int mod = 2000;
const int dr[] = {-1, 1, 0, 0};
const int dc[] = {0, 0, 1, -1};
const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
int T; cin >> T;
while(T--){
cin >> n >> m;
cout << (1LL<<n-m) << endl;
}
return 0;
}
HDU 1995 汉诺塔V (水题)的更多相关文章
- HDOJ 1995 汉诺塔V
Problem Description 用1,2,-,n表示n个盘子,称为1号盘,2号盘,-.号数大盘子就大.经典的汉诺塔问 题经常作为一个递归的经典例题存在.可能有人并不知道汉诺塔问题的典故.汉诺塔 ...
- HDU 1995 R-汉诺塔V
https://vjudge.net/contest/67836#problem/R 用1,2,...,n表示n个盘子,称为1号盘,2号盘,....号数大盘子就大.经典的汉诺塔问 题经常作为一个递归的 ...
- 汉诺塔III 汉诺塔IV 汉诺塔V (规律)
汉诺塔III Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Subm ...
- HDUOJ---(1995)汉诺塔V
汉诺塔V Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 题解报告:hdu1995汉诺塔V(递推dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1995 Problem Description 用1,2,...,n表示n个盘子,称为1号盘,2号盘,. ...
- 汉诺塔系列问题: 汉诺塔II、汉诺塔III、汉诺塔IV、汉诺塔V、汉诺塔VI
汉诺塔 汉诺塔II hdu1207: 先说汉若塔I(经典汉若塔问题),有三塔.A塔从小到大从上至下放有N个盘子.如今要搬到目标C上. 规则小的必需放在大的上面,每次搬一个.求最小步数. 这个问题简单, ...
- HDU 2077 汉诺塔IV (递推)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2077 还记得汉诺塔III吗?他的规则是这样的:不允许直接从最左(右)边移到最右(左)边(每次移动一定是 ...
- HDU 1207 汉诺塔II (找规律,递推)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1207 汉诺塔II Time Limit: 2000/1000 MS (Java/Others) ...
- hdu 1207 汉诺塔II (DP+递推)
汉诺塔II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
随机推荐
- 如何绕过Win8、Win10的systemsetting与注册表校验设置默认浏览器
*本文原创作者:浪子_三少,属Freebuf原创奖励计划,未经许可禁止转载 在win7时我们只需修改注册表就能设置默认浏览器,但是win8.win10下不能直接修改的因为同样的注册表项,win8.wi ...
- 制作ubuntu U盘安装盘
sudo dd if=ubuntu.iso of=/dev/sdb2 sudo syslinux /dev/sdb1
- centos7 网络不能重启问题 解决办法
cnetos7 网络不可重启 突然解决办法 参考他人处理 之前部署hadoop环境,在自己机器上安装了一台centos虚拟机,然后图省事,就克隆出三台,一台为master,另两台来作为 slave. ...
- NAND FLash基础概念介绍
一.引脚介绍 引脚名称 引脚功能 CLE 命令锁存功能 ALE 地址锁存功能 /CE 芯片使能 /RE 读使能 /WE 写使能 /WP 写保护 R/B 就绪/忙输出信号 Vcc 电源 Vss 地 N. ...
- HDOJ 1217 Arbitrage(拟最短路,floyd算法)
Arbitrage Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- 父节点parentNode
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- HDU 1398 Square Coins(母函数或dp)
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- LINQ体验(18)——LINQ to SQL语句之视图和继承支持
视图 我们使用视图和使用数据表类似,仅仅需将视图从"server资源管理器/数据库资源管理器"拖动到O/R 设计器上,自己主动能够创建基于这些视图的实体类.我们能够同操作数据表一样 ...
- GET和POST解析
Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符,我们可以这样认为:一个URL地址,它用于描述一个网络上的资源,而HTTP ...
- 仿udhcpd配置文件读取的一段代码
前段时间看udhcpd的源代码,后来因为没直接应用,也就放弃了.网上有文章udhcpd详解(搜索一下有很多),其中在介绍udhcpd的配置相关代码时,有如下一句话,学习了这段代码后,以后用到需要读配置 ...