随笔分类 -  POJ ac之路

摘要:名字是法雷数列其实是欧拉phi函数 Farey SequenceTime Limit:1000MSMemory Limit:65536KTotal Submissions:11246Accepted:4363DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 2 #include 3 #include 4 5 using namespace std; 6 7 typedef unsigned l... 阅读全文
posted @ 2013-11-04 14:54 码代码的猿猿 阅读(197) 评论(0) 推荐(0)
摘要:Making the GradeTime Limit:1000MSMemory Limit:65536KTotal Submissions:3436Accepted:1608DescriptionA straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of an alt... 阅读全文
posted @ 2013-11-02 13:13 码代码的猿猿 阅读(559) 评论(0) 推荐(0)
摘要:以前做过的题目了。。。。补集+DP Check the difficulty of problemsTime Limit:2000MSMemory Limit:65536KTotal Submissions:4091Accepted:1811DescriptionOrganizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following.. 阅读全文
posted @ 2013-10-30 10:10 码代码的猿猿 阅读(157) 评论(0) 推荐(0)
摘要:很久以前就见过的。。。最基本的概率DP。。。除法配合位运算可以很容易的判断下一场要和谁比。 from——Dinic算法 FootballTime Limit:1000MSMemory Limit:65536KTotal Submissions:2499Accepted:1258DescriptionConsider a single-elimination football tournament involving 2nteams, denoted 1, 2, …, 2n. In each round of the tournament, all teams still... 阅读全文
posted @ 2013-10-29 14:57 码代码的猿猿 阅读(225) 评论(0) 推荐(0)
摘要:分段的概率DP+矩阵快速幂 Scout YYF ITime Limit:1000MSMemory Limit:65536KTotal Submissions:4180Accepted:1076DescriptionYYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties, YYF is now at the start of enemy's famo.. 阅读全文
posted @ 2013-10-29 09:17 码代码的猿猿 阅读(263) 评论(0) 推荐(0)
摘要:状压DP。。。十几年前的题目,一定得A掉。。。。。 炮兵阵地Time Limit:2000MSMemory Limit:65536KTotal Submissions:16432Accepted:6252Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮 阅读全文
posted @ 2013-10-16 15:49 码代码的猿猿 阅读(264) 评论(0) 推荐(0)
摘要:3维空间中的最小生成树。。。。好久没碰关于图的东西了。。。。。 Building a Space StationTime Limit:1000MSMemory Limit:30000KTotal Submissions:3804Accepted:1940DescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a compu... 阅读全文
posted @ 2013-10-15 23:48 码代码的猿猿 阅读(161) 评论(0) 推荐(0)
摘要:有一种定理,叫毕克定理。。。。 AreaTime Limit:1000MSMemory Limit:10000KTotal Submissions:4352Accepted:1977DescriptionBeing well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the com... 阅读全文
posted @ 2013-10-14 15:14 码代码的猿猿 阅读(214) 评论(0) 推荐(0)
摘要:二维树状数组。。。。 MatrixTime Limit:3000MSMemory Limit:65536KTotal Submissions:15575Accepted:5854DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 2 #include 3 #include 4 5 using names... 阅读全文
posted @ 2013-10-11 17:50 码代码的猿猿 阅读(198) 评论(0) 推荐(0)
摘要:贪心。。。。 Color a TreeTime Limit:1000MSMemory Limit:30000KTotal Submissions:6647Accepted:2249DescriptionBob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the "root" of the tree, and there is a unique path from the 阅读全文
posted @ 2013-10-10 18:06 码代码的猿猿 阅读(411) 评论(0) 推荐(0)
摘要:RMQ+二分。。。。枚举 i,找比 i 小的第一个元素,再找之间的第一个最大元素。。。。。 Sticks ProblemTime Limit:6000MSMemory Limit:65536KTotal Submissions:9338Accepted:2443DescriptionXuanxuan has n sticks of different length. One day, she puts all her sticks in a line, represented by S1, S2, S3, ...Sn. After measuring the length of... 阅读全文
posted @ 2013-10-08 22:08 码代码的猿猿 阅读(297) 评论(0) 推荐(0)
摘要:Expanding RodsTime Limit:1000MSMemory Limit:30000KTotal Submissions:10187Accepted:2593DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion.When a thin rod is mounted on two solid walls and then he... 阅读全文
posted @ 2013-10-06 22:35 码代码的猿猿 阅读(277) 评论(0) 推荐(0)
摘要:扩展GCD。。。一定要(1L 2 #include 3 #include 4 5 using namespace std; 6 7 typedef long long int LL; 8 9 inline LL P(LL k){return (1LL<<k);}10 11 LL GCD(LL a,LL b)12 {13 return b==0?a:GCD(b,a%b);14 }15 16 LL EX_GCD(LL a,LL b,LL& x,LL& y)17 {18 if(b==0)19 {20 x=1;y=0;21 return... 阅读全文
posted @ 2013-10-04 16:08 码代码的猿猿 阅读(249) 评论(0) 推荐(0)
摘要:青蛙的约会Time Limit:1000MSMemory Limit:10000KTotal Submissions:82859Accepted:14426Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙... 阅读全文
posted @ 2013-10-04 14:11 码代码的猿猿 阅读(233) 评论(0) 推荐(0)