
枚举
synapse7
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #131 (Div. 2) / 214A System of Equations(枚举&优化)
A. System of Equationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFurik loves math lessons very much,原创 2013-08-25 14:20:28 · 1345 阅读 · 0 评论 -
UVa 11210 Chinese Mahjong (模拟&枚举&回溯)
11210 - Chinese MahjongTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2151Mahjong () is a game of Chinese origin usually played by原创 2013-10-13 21:19:55 · 917 阅读 · 0 评论 -
UVa 1225 Digit Counting (枚举)
1225 - Digit CountingTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3666N完整代码:#includeint c[原创 2013-11-25 21:41:35 · 1491 阅读 · 0 评论 -
UVa 1042 Lots of Sunlight (枚举&最优斜率)
1042 - Lots of SunlightTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3483思路:对于给定的楼层,枚举左、右的最大斜率。at原创 2013-11-26 00:41:37 · 2141 阅读 · 0 评论 -
UVa 10125 Sumsets (折半枚举&二分查找)
10125 - SumsetsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1066Given S, a set of integers, find the largest d such that a + b +原创 2013-11-13 17:30:49 · 2235 阅读 · 0 评论 -
Shanghai 2006 / UVa 1382 Distant Galaxy (枚举&扫描&动态维护)
1382 - Distant GalaxyTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=460&page=show_problem&problem=4128You are observing a distant gal原创 2013-11-13 18:07:48 · 1124 阅读 · 0 评论 -
UVa 10277 Boastin' Red Socks (枚举)
10277 - Boastin' Red SocksTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1218You have a drawer that is fu原创 2013-11-28 16:46:45 · 1397 阅读 · 0 评论 -
UVa 471 Magic Numbers (枚举)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=412直接枚举。代码中给出了一个用位运算判断数字中是否有重复数字的方法。完整代码:/*0.032s*/#include const long long原创 2013-12-06 22:01:16 · 956 阅读 · 0 评论 -
UVa 10012 How Big Is It? (枚举&细节)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=953思路:最多8个球,直接枚举。注意:1. 由于一个圆不一定与圆心横坐标与其横坐标最接近的圆相切,所以判断一个圆圆心横坐标的实际位置要一一比较在原创 2013-12-05 22:55:38 · 1210 阅读 · 0 评论 -
UVa 10360 Rat Attack (枚举&优化)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1301由于格子数远大于鼠窝,所以以鼠窝为出发点,增加鼠窝周围d范围内的“格子的值”,最后扫描每个格子输出最大格子值即可。完整代码:/*0.125s*/#原创 2013-12-07 10:36:33 · 1193 阅读 · 0 评论 -
UVa 757 / POJ 1042 / East Central North America 1999 Gone Fishing (枚举&贪心&想法题&优先队列)
757 - Gone FishingTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=698John is going on a fishing trip. He has h hours a原创 2013-09-27 08:17:38 · 1517 阅读 · 0 评论 -
USACO The Clocks 一种O(1)的算法
The ClocksIOI'94 - Day 2Consider nine clocks arranged in a 3x3 array thusly:|-------| |-------| |-------| | | | | | | | |---O | |---O | | O |原创 2014-02-05 08:28:27 · 2087 阅读 · 0 评论 -
UVa 216 Getting in Line (全排列&枚举)
216 - Getting in LineTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=152Computer networking requires that the computer原创 2013-10-25 08:28:38 · 980 阅读 · 0 评论 -
ZOJ 3762 Pan's Labyrinth (点集中的最大点-线距&技巧性枚举)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3762思路:(转自这篇文章)假设拥有最大高的三角形是ABC,如下图结合此图我们可以看出最大高是点C到直线AB,在这种情况下,下列两个假设至少有一个成立1.点C是所有点中距离点A最远的2.点C是所有点中距离点B最远的反证:(这里先证明在AB上侧成立的情况原创 2014-03-10 18:59:17 · 1751 阅读 · 2 评论 -
UVa 256 Quirksome Squares (枚举||二次同余)
直接从0~9999枚举即可,因为等式右边一定是个完全平方数。PS:此题可抽象成一个数论的问题:(部分解法参考了这篇文章)求解4个二元二次丢番图方程 (x+y)^2=2mx+y,m=10^k / 2 = 2^(k-1)*5^(2k),k=1,2,3,4令x+y=t,上式化为 t^2-2mt+(2m-1)y=0(由于0<=t^2<10^2k,所以0<=t<10^k)进而 (t-m)^2=(1-2m)y+m^2此方程的等价于求解二次同余式原创 2013-11-23 09:08:11 · 3293 阅读 · 0 评论 -
UVa 701 The Archeologists' Dilemma (数学&枚举)
701 - The Archeologists' DilemmaTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=642An archeologist seekin原创 2013-09-27 13:23:38 · 1271 阅读 · 0 评论 -
HDU 2566 统计硬币(O(m^3)枚举+优化成O(m))
统计硬币http://acm.hdu.edu.cn/showproblem.php?pid=2566Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description假设一堆由1分、2分、5分组成的n个硬币总面原创 2013-08-14 13:43:10 · 1067 阅读 · 0 评论 -
POJ 2245 Lotto (枚举)
Lottohttp://poj.org/problem?id=2245Time Limit: 1000MSMemory Limit: 65536KDescriptionIn the German Lotto you have to select 6 numbers from the set {1,2,...,49}. A popular原创 2013-08-23 13:08:41 · 1030 阅读 · 0 评论 -
Codeforces Round #105 (Div. 2) / 148A Insomnia cure (枚举 || 数论)
A. Insomnia curehttp://codeforces.com/problemset/problem/148/Atime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output原创 2013-08-24 09:53:59 · 2354 阅读 · 0 评论 -
Tokyo 2005 / UVa 1352 Colored Cubes (部分枚举&贪心)
1352 - Colored CubesTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=456&page=show_problem&problem=4098There are several colored cubes.原创 2013-09-04 18:01:26 · 1076 阅读 · 0 评论 -
UVa 11464 Even Parity (想法题&部分枚举)
11464 - Even ParityTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=456&page=show_problem&problem=2459We have a grid of size N x N. Each原创 2013-09-03 08:05:58 · 826 阅读 · 0 评论 -
UVa 143 Orchard Trees (数学&计算几何&枚举)
143 - Orchard TreesTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=79An Orchardist has planted an orchard in a rectang原创 2013-09-27 19:21:06 · 1438 阅读 · 0 评论 -
UVa 10167 Birthday Cake (枚举)
10167 - Birthday CakeTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=1108BackgroundLucy and Lily are原创 2013-10-15 08:18:12 · 1084 阅读 · 0 评论 -
UVa 131 The Psychic Poker Player (枚举&模拟好题)
131 - The Psychic Poker PlayerTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=67In 5-card draw poker, a p原创 2013-10-15 19:20:25 · 1253 阅读 · 0 评论 -
UVa 11205 The broken pedometer (枚举好题&巧用二进制)
11205 - The broken pedometerTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=2146The ProblemA marathon原创 2013-10-15 18:18:04 · 963 阅读 · 0 评论 -
UVa 10344 23 out of 5 (全排列枚举&回溯)
10344 - 23 out of 5Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1285Your task is to write a program t原创 2013-10-16 18:05:41 · 1097 阅读 · 0 评论 -
UVa 11218 KTV (枚举&位运算)
11218 - KTVTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=112&page=show_problem&problem=2159One song is extremely popular recently, s原创 2013-11-15 23:54:08 · 1392 阅读 · 0 评论 -
UVa 10465 Homer Simpson (枚举)
10465 - Homer SimpsonTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=114&page=show_problem&problem=1406这数据量。。枚举绝对是最快的方式了。完整代码:原创 2013-11-19 21:51:48 · 1434 阅读 · 0 评论 -
AOJ 0033 Ball (枚举)
题意:有一个形似央视大楼(233)的筒,从A口可以放球,放进去的球可通过挡板DE使其掉进B裤管或C裤管里,现有带1-10标号的球按给定顺序从A口放入,问是否有一种控制挡板的策略可以使B裤管和C裤管中的球从下往上标号递增。 输入:第一行输入数据组数N。接下来N行为N组具体数据,每组数据中有10个整数,代表球的放入顺序。 输出:对于每组数据,若策略存在,输出YES;若不存在,输原创 2013-11-07 17:52:05 · 2227 阅读 · 0 评论 -
Codeforces Round #206 (Div. 2) / 355C (转化&枚举)
http://codeforces.com/contest/355/problem/C枚举i,左手操作了i次,右手操作了n-i次,然后重复次数可以直接算出来,所以答案就可以在O(n)的时间内算出来。/*30ms,4000KB*/#includeusing namespace std;int a[100005];int main(){ int n, l, r,原创 2014-03-14 20:17:32 · 1001 阅读 · 0 评论