摘要: 题目:C. Laddertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment 阅读全文
posted @ 2013-03-10 21:12 fly_lovelove 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 思路,简单dp题,开始想歪了,然后想通了代码如下:#include <cstdio>#include <cstring>using namespace std;const int N = 101;int dp[N][N][2];//f[N][N][2];void inti(){// f[2][1][1] = 1;// f[2][0][0] = 1;// f[2][0][1] = 1; dp[2][1][1] = 1; dp[2][0][1] = 1; dp[2][0][0] = 2; for(int i = 2;i <= 99;i ++) for... 阅读全文
posted @ 2013-03-09 19:33 fly_lovelove 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题意:棋盘覆盖时间限制:3000 ms | 内存限制:65535 KB难度:3在一个2k×2k(1<=k<=100)的棋盘中恰有一方格被覆盖,如图1(k=2时),现用一缺角的2×2方格(图2为其中缺右下角的一个),去覆盖2k×2k未被覆盖过的方格,求需要类似图2方格总的个数s。如k=1时,s=1;k=2时,s=5答案就是:4^0 + 4 ^ 1 + 4 ^ 2 + ....... + 4 ^(n - 1)大数直接模拟即可代码: 1 2 #include <iostream> 3 #include <cstring> 4 #inc 阅读全文
posted @ 2013-03-05 21:43 fly_lovelove 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题意:给出一些坐标关系求,从出发点某个点需要拐多少弯?直接模拟即可 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 struct st 5 { 6 int x,y; 7 }p[1001]; 8 int x,y; 9 void inti()10 {11 p[0].x = 0;p[0].y = 0;12 p[1].x = 1;p[1].y = 0;13 p[2].x = 1;p[2].y = 1;14 int k = 3;15 int flag = 0,len = 2... 阅读全文
posted @ 2013-03-05 21:27 fly_lovelove 阅读(183) 评论(0) 推荐(0) 编辑