摘要: 题意:还记得汉诺塔III吗?他的规则是这样的:不允许直接从最左(右)边移到最右(左)边(每次移动一定是移到中间杆或从中间移出),也不允许大盘放到小盘的上面。xhd在想如果我们允许最大的盘子放到最上面会怎么样呢?(只允许最大的放在最上面)当然最后需要的结果是盘子从小到大排在最右边。分析:dp[i][0]表示将 i 个盘子从两边移动到中间的步数dp[i][1]表示将 i 个盘子从中间移动到两边的步数讲n个盘子从左边移动到右边的总步数为 dp[i-1][0]+dp[i-1][1]+2View Code #include <cstdio>#include <cstring>in 阅读全文
posted @ 2013-02-12 17:03 'wind 阅读(394) 评论(0) 推荐(0) 编辑
摘要: ................................目录..................................Round #167 (Div. 2)A.Dima and Friends 类型: 模拟题意:有n个朋友每个人出1~5中的一个数,自己可以出1~5中的任意一个数,把所有数的和加起来得到的m,从自己开始一次倒数 最后一个人扫地,问自己有多少种出法,自己不用扫地。分析:直接模拟View Code #include <cstdio>#include <cstring>#include <algorithm>#include < 阅读全文
posted @ 2013-02-12 12:03 'wind 阅读(267) 评论(0) 推荐(0) 编辑
摘要: A.Beautiful Year题意:找到大于y的第一个每位都不相同的年。View Code #include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;#define clr(x) memset(x,0,sizeof(x))int a[4];int main(){ int y; while (scanf("%d",&y)!=EOF) { y++; for (;;y++) { int x = ... 阅读全文
posted @ 2013-02-12 11:58 'wind 阅读(260) 评论(0) 推荐(0) 编辑