随笔分类 -  OI-刷题目

摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1803 Solution: 考虑两个数x,y乘积%2016=0 x×y≡0(MOD 2016) x=p1×2016+q1 y=p2×2016+q2 x×y=(p1×2016+q1)×(p2×2016+ 阅读全文
posted @ 2016-10-19 22:11 _Mashiro 阅读(271) 评论(0) 推荐(1)
摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1756 直接暴力O(n^2logn)过不了 两两算gcd 考虑每个数的范围[1,1000]统计一下即可O(1000^2*log(1000)) Notice:1与任何数互质,需要特判(自己与自己互质) 阅读全文
posted @ 2016-10-19 20:29 _Mashiro 阅读(142) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1017 艰难啊 弄了很久咧 拍了几十万组,以后拍要多组数据 Solution 从大wangxiaofang 从大往小放,有空余的从大往小填 注意细节 Notice b<0的情况,还有就是当前填充完了,还剩一点给下一个(小一点的)填 Code 阅读全文
posted @ 2016-10-19 19:35 _Mashiro 阅读(211) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/2347/ Solution 二分图板子 连边:i认识j并且j是在校有床 i→j+n i有床i→i+n 还有就是找要在学校的人,1.有床不回2.没床的(一定来探望) 记录一下二分图最大匹配是否等于要在校的学生即可 福利数据 IN 2 120 1 1 阅读全文
posted @ 2016-10-19 15:41 _Mashiro 阅读(210) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/1376/ 枚举修改哪两位,将sum减去之前位置的数+交换之后 %m==0即可 预处理26的次方+O(n^2) 阅读全文
posted @ 2016-10-18 22:14 _Mashiro 阅读(260) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/2630/ Solution 预处理f[i][j],代表第j列前i行的代价 枚举上下界,然后做最大子段和,g[i]代表选到第i列的代价, g[k]=(g[k-1]<0?0:g[k-1])+f[j][k]-f[i-1][k] 复杂度O(n^3) Not 阅读全文
posted @ 2016-10-18 21:28 _Mashiro 阅读(215) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/2115/ 阅读全文
posted @ 2016-10-18 20:29 _Mashiro 阅读(247) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2037 “今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。作为球迷,一定想看尽量多的 阅读全文
posted @ 2016-10-18 17:53 _Mashiro 阅读(173) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/4672/ 那个一看这不是(最大独立集)的最大权值和,类似 反图→ 最大团 NP问题 搜索解决 改一下模板即可 参考最大独立集 Maximum Clique最大团问题 阅读全文
posted @ 2016-10-18 16:39 _Mashiro 阅读(266) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/3115/ 板子题~ 阅读全文
posted @ 2016-10-17 20:01 _Mashiro 阅读(354) 评论(0) 推荐(0)
摘要:http://codevs.cn/problem/1031/ 不讲什么,预处理素数+搜索 阅读全文
posted @ 2016-10-17 19:57 _Mashiro 阅读(219) 评论(0) 推荐(0)
摘要:获取敌情 Input Output 对于每一组测试案例,在每一行输出破解后的字符串Ttr。 Sample Input Sample Output Solution 靠,历时悠久 最开始压根就没管两边相等的情况,直接输出 然后发现有相等的情况,开始各种讨论: 话说我的其实可以不讨论的,直接输出相等的比 阅读全文
posted @ 2016-10-17 19:32 _Mashiro 阅读(527) 评论(0) 推荐(0)
摘要:Position: http://codevs.cn/problem/3151/ List 【Codevs3151】交通管制I List Description Input Output Sample Input Sample Output HINT Solution Code 【Codevs315 阅读全文
posted @ 2016-10-16 21:45 _Mashiro 阅读(273) 评论(0) 推荐(0)
摘要:D. Complete The Graph time limit per test: 4 seconds memory limit per test: 256 megabytes input: standard input output: standard output ZS the Coder h 阅读全文
posted @ 2016-10-16 10:39 _Mashiro 阅读(683) 评论(0) 推荐(1)
摘要:Position Solution 2×n^2-n+1 证明见分割问题 Code 阅读全文
posted @ 2016-10-14 22:32 _Mashiro 阅读(474) 评论(0) 推荐(0)
摘要:Position: http://codevs.cn/problem/1183/ List Codevs1183 泥泞的道路 List Description Input Output Sample Input Sample Output HINT Solution Code Description 阅读全文
posted @ 2016-10-13 23:05 _Mashiro 阅读(271) 评论(0) 推荐(1)
摘要:连环锁 Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 1260 Accepted: 403 Description 许多人一定很熟悉九连环(如下图),九个环被串在一起,操作规则如下:第一个(右边)环可以任意装卸,如果第k个环没有 阅读全文
posted @ 2016-10-12 18:52 _Mashiro 阅读(628) 评论(0) 推荐(0)
摘要:Chain Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3414 Accepted: 1126 Description Byteland had not always been a democratic country. Th 阅读全文
posted @ 2016-10-12 18:04 _Mashiro 阅读(509) 评论(0) 推荐(1)
摘要:Piotr's Ants Porsition:Uva 10881 白书P9 中文改编题:【T^T】【FJUT】第二届新生赛真S题地震了 "One thing is for certain: there is no stopping them;the ants will soon be here. A 阅读全文
posted @ 2016-10-11 20:37 _Mashiro 阅读(174) 评论(0) 推荐(0)
摘要:Position: http://codevs.cn/problem/1288/ Description 在古埃及,人们使用单位分数的和(形如1/a的, a是自然数)表示一切有理数。 如:2/3=1/2+1/6,但不允许2/3=1/3+1/3,因为加数中有相同的。 对于一个分数a/b,表示方法有很多 阅读全文
posted @ 2016-09-28 15:23 _Mashiro 阅读(272) 评论(0) 推荐(0)