上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 57 下一页
摘要: 题目链接:http://codeforces.com/problemset/problem/402/A题目意思:几经辛苦,终于体明题目噶意思了 = =,完全是考验一个人是否清醒的最简便方法- -! 给出4个数,分别为k,a,b和v。k:1个box最大可以分成的section;a:需要放置的nut的个数;b:divisor的数量 v:每个section的容量。有两个约束条件:(1)每个box的section数不能超过k个; (2)放置的nut的数量不能超过v个(即不能超过section的最大容量)。注意:x个divisor可以得到x + 1个section,每个section的容量为v个。 .. 阅读全文
posted @ 2014-03-18 15:24 windysai 阅读(385) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/402/B题目意思:给出n个数和公差k,问如何调整使得ai + 1 - ai = k。(1 ≤ i = 1!! 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1000 + 10; 7 int a[maxn], rea[maxn][2]; // a:原始输入序列 rea:保存需要调整的数的调整大小 8 char ch[maxn]; 9 10 int main() 11... 阅读全文
posted @ 2014-03-18 14:49 windysai 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 题目链接:(这个是内网的网址) http://172.22.27.1/problem?pid=1013 Good SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem DescriptionA sequence contains n integers.A sequence p1, p2, p3...pnis a good sequence if it satisfies... 阅读全文
posted @ 2014-03-17 23:13 windysai 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/401/C题目意思:给出0和1的数目(分别为n和m个),问是否能构造一条同时满足连续两个0不能再一起和连续三个1不能在一起,并且长度为n+m的序列,不能输出-1。 首先需要知道什么时候不能构造出来。假设c0代表0的数目,c1表示1的数目。那么可以构造的条件是:c0-1 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1e6 + 5; 7 int a[2*maxn]; 8 9 int main()10 {11 ... 阅读全文
posted @ 2014-03-15 23:22 windysai 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 题目描述: IP Checking Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)Problem DescriptionAn IP address is a 32 bit address formatted in the following way:a.b.c.dwhere a, b, c, d are integers each ranging from 0 to 255. Now you are given two IP... 阅读全文
posted @ 2014-03-04 23:02 windysai 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/262/B题目意思:给出 n 个数和恰好一共要做的操作总数k。通过对n个数进行k次操作,每次操作可以把a[i] 转化为 -a[i](当然也可以对同一个数进行 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 1e5 + 10; 8 int a[maxn]; 9 10 int main()11 {12 int n, k, i, ans, cnt;13 while (scanf(... 阅读全文
posted @ 2014-03-04 20:52 windysai 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1106 这个题目一开始以为是水题,就想着用来轻松轻松,谁知道改得我想吐!! 除了discuss 中的数据外,还加上这两组,一般就能过了:001568970056 5551235555789 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1000 + 10; 7 char s[maxn], t[maxn]; 8 int a[maxn]; 9 10 int main()11 {12 ... 阅读全文
posted @ 2014-03-02 21:25 windysai 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/275/B题目内容:给出一个n * m 大小的grid,上面只有 black 和 white 两种颜色填充。问任意两个black cell 的连通是否满足最多转一次弯而达到。当然,如果有好多堆black cell 也是不满足条件的,即只能有一堆!! 这是继color the fence 之后,又一条花了我很长时间才做出来的题目,因为搜索这些技巧学不好,于是只能结合观察能力做出来了。其实最直接的方法应该是bfs,可惜= =,好啦我会加油的!!! 主要分成两个个部分判断:1、black cell 是否有且仅 阅读全文
posted @ 2014-02-25 22:25 windysai 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/284/C题目意思:给出3种操作:t = 1:在前 a 个数中每个数都加上x; t= 2:在数组末尾增加一个数k,数组长度相应增加1; t =3:删除数组最后一个数,数组长度减少1。对于n次操作,都给出整个数组所有元素的平均值。一开始看见题目意思那么容易懂,于是以为很容易做,错足14次,15次终于成功了。先是TLE(对操作2直接暴力循环加),后在Test 10 wa wa wa~~~,说误差超了,全部不知道是什么回事! 其实3个操作不需要都模拟出来,操作3是比较麻烦的,因为删除的数有可能经过 t = 1 阅读全文
posted @ 2014-02-19 22:05 windysai 阅读(318) 评论(2) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/279/A题目意思:给出一个坐标点(x, y),问当从(0, 0) 开始到达该点转过的拐角有多少个。(拐角是这样的:(0, 0) -> (1, 0) -> (1, 1) -> (-1, 1) -> (-1, -1) -> (2, -1) -> (2, 2) ->...),总的来说,对于每一圈可以想成它是从坐标系的第四象限开始的(x > 0 && y 2 #include 3 #include 4 #include 5 using names 阅读全文
posted @ 2014-02-16 23:30 windysai 阅读(292) 评论(0) 推荐(0) 编辑
上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 57 下一页