上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 47 下一页
摘要: 题目传送门 1 /* 2 题意:给出无向无环图,每一个点的度数和相邻点的异或和(a^b^c^....) 3 图论/位运算:其实这题很简单。类似拓扑排序,先把度数为1的先入对,每一次少一个度数 4 关键在于更新异或和,精髓:a ^ b = c -> a ... 阅读全文
posted @ 2015-06-11 19:46 Running_Time 阅读(175) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:给出一种方案使得abs (A - G) 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 const int MAXN = 1e6 + 10;13 cons... 阅读全文
posted @ 2015-06-10 16:13 Running_Time 阅读(167) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr。。。 ans = a[1] + a[2]; 3 或先2个+1个,然后k个rgb。。。r = x + k; g = 2 * (x + z) +... 阅读全文
posted @ 2015-06-10 16:00 Running_Time 阅读(145) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:按照能选的个数和点数降序排序,当条件不符合就break,水题啊! 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 const int MAXN =... 阅读全文
posted @ 2015-06-10 15:54 Running_Time 阅读(137) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:每一次选取最多的线段,最大能放置nuts,直到放完为止,很贪婪! 3 题目读不懂多读几遍:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 1... 阅读全文
posted @ 2015-06-10 15:49 Running_Time 阅读(136) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 二分查找/暴力:先埃氏筛选预处理,然后暴力对于每一行每一列的不是素数的二分查找最近的素数,更新最小值 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 9 cons... 阅读全文
posted @ 2015-06-09 15:11 Running_Time 阅读(235) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 水题:三个字符串判断每个是否有相应的元音字母,YES/NO 3 下午网速巨慢:( 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using nam... 阅读全文
posted @ 2015-06-09 15:10 Running_Time 阅读(160) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:选择k个m长的区间,使得总和最大 3 01背包:dp[i][j] 表示在i的位置选或不选[i-m+1, i]这个区间,当它是第j个区间。 4 01背包思想,状态转移方程:dp[i][j] = max (dp[i-1][j], dp[i-... 阅读全文
posted @ 2015-06-08 19:49 Running_Time 阅读(139) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std... 阅读全文
posted @ 2015-06-08 10:32 Running_Time 阅读(146) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心/二分查找:首先对ai%=p,然后sort,这样的话就有序能使用二分查找。贪心的思想是每次找到一个aj使得和为p-1(如果有的话) 3 当然有可能两个数和超过p,那么an的值最优,每次还要和an比较 4 注意:不能选取两个... 阅读全文
posted @ 2015-06-08 10:23 Running_Time 阅读(161) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:有n个商店排成一条直线,有一些商店有先后顺序,问从0出发走到n+1最少的步数 3 贪心:对于区间被覆盖的点只进行一次计算,还有那些要往回走的区间步数*2,再加上原来最少要走n+1步就是答案了 4 详细解释:http://blog.csdn.ne... 阅读全文
posted @ 2015-06-07 18:35 Running_Time 阅读(265) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 模拟/字符串处理:主要是对*的处理,先把乘的预处理后再用加法,比如说是:1+2*3+4 = 1+..6+4 = 11 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include ... 阅读全文
posted @ 2015-06-07 18:29 Running_Time 阅读(222) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:按照0或1开头,若不符合,选择后面最近的进行交换。然后选取最少的交换次数 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #i... 阅读全文
posted @ 2015-06-07 18:25 Running_Time 阅读(255) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 9 const int MAXN ... 阅读全文
posted @ 2015-06-06 17:24 Running_Time 阅读(180) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 暴力:O (n^2) 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 1e4 + 10;12 ... 阅读全文
posted @ 2015-06-06 16:34 Running_Time 阅读(253) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 47 下一页