摘要: 题目传送门 1 /* 2 BFS+模拟:dp[i][j][p] 表示走到i,j,方向为p的步数为多少; 3 BFS分4种情况入队,最后在终点4个方向寻找最小值:) 4 */ 5 #include 6 #include 7 #include 8 #... 阅读全文
posted @ 2015-04-27 20:57 Running_Time 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 1 /* 2 贪心水题:首先,最少的个数为n最大的一位数字mx,因为需要用1累加得到mx, 3 接下来mx次循环,若是0,输出0;若是1,输出1,s[j]--; 4 注意:之前的0的要忽略 5 */ 6 #include 7 #include ... 阅读全文
posted @ 2015-04-27 20:19 Running_Time 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 1 /* 2 水题:一开始看错题意,以为是任意切割,DFS来做;结果只是在中间切出一段来 3 判断是否余下的是 "CODEFORCES" :) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #incl... 阅读全文
posted @ 2015-04-27 19:23 Running_Time 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 1 /* 2 设一个b[]来保存每一个a[]的质因数的id,从后往前每一次更新质因数的id, 3 若没有,默认加0,nlogn复杂度; 4 我用暴力竟然水过去了:) 5 */ 6 #include 7 #include 8 #include 9 #i... 阅读全文
posted @ 2015-04-27 17:35 Running_Time 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 1 /* 2 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少; 3 否则再在tot里减去多余的即为答案 4 用set容器也可以做,思路一样 5 */ 6 #include 7 #include ... 阅读全文
posted @ 2015-04-27 12:46 Running_Time 阅读(160) 评论(0) 推荐(0) 编辑