随笔分类 -  /* 圣人不死 AC不止!*/

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 32 下一页
coding不息!
摘要:题目传送门 1 /* 2 题意:给出一系列名字变化,问最后初始的名字变成了什么 3 字符串处理:每一次输入到之前的找相印的名字,若没有,则是初始的,pos[m] 数组记录初始位置 4 在每一次更新时都把初始pos加上去,那么就保证更新了初始的名字,这也... 阅读全文
posted @ 2015-06-11 19:48 Running_Time 阅读(179) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 题意:给出无向无环图,每一个点的度数和相邻点的异或和(a^b^c^....) 3 图论/位运算:其实这题很简单。类似拓扑排序,先把度数为1的先入对,每一次少一个度数 4 关键在于更新异或和,精髓:a ^ b = c -> a ... 阅读全文
posted @ 2015-06-11 19:46 Running_Time 阅读(172) 评论(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 阅读(162) 评论(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 阅读(143) 评论(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 阅读(136) 评论(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 阅读(135) 评论(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 阅读(159) 评论(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 阅读(138) 评论(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 阅读(144) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 贪心/二分查找:首先对ai%=p,然后sort,这样的话就有序能使用二分查找。贪心的思想是每次找到一个aj使得和为p-1(如果有的话) 3 当然有可能两个数和超过p,那么an的值最优,每次还要和an比较 4 注意:不能选取两个... 阅读全文
posted @ 2015-06-08 10:23 Running_Time 阅读(158) 评论(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 阅读(264) 评论(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 阅读(221) 评论(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 阅读(252) 评论(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 阅读(178) 评论(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 阅读(251) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 我校oj的源题,看懂题意就很水,贴出来省的再敲:) 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 9 const int MAXN = 1e3 + 10;10 const int... 阅读全文
posted @ 2015-06-06 16:33 Running_Time 阅读(143) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 const i... 阅读全文
posted @ 2015-06-05 21:43 Running_Time 阅读(133) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案;用到sprintf把数字转移成字符读入 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 usin... 阅读全文
posted @ 2015-06-05 17:48 Running_Time 阅读(193) 评论(0) 推荐(0)
摘要:题目传送门 1 /* 2 DFS: 排序后一个一个出发往后找,找到>r为止,比赛写了return ; 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #inc... 阅读全文
posted @ 2015-06-05 17:43 Running_Time 阅读(124) 评论(0) 推荐(0)

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 32 下一页