上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 53 下一页
摘要: Power NetworkTime Limit:2000MSMemory Limit:32768KTotal Submissions:19534Accepted:10300DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 #i 阅读全文
posted @ 2013-03-14 10:28 剑不飞 阅读(245) 评论(0) 推荐(0) 编辑
摘要: Raucous RockersYou just inherited the rights to N (1 #include using namespace std; ifstream cin("rockers.in"); ofstream cout("rockers.out"); const int mm=33; class node { public:int t,c; node(){t=c=0;} }dp[mm][mm]; int n,t,m; int s[mm]; int main() { while(cin>>n>>t> 阅读全文
posted @ 2013-03-13 17:34 剑不飞 阅读(492) 评论(0) 推荐(0) 编辑
摘要: Electric FenceDon PieleIn this problem, `lattice points' in the plane are points with integer coordinates.In order to contain his cows, Farmer John constructs a triangular electric fence by stringing a "hot" wire from the origin (0,0) to a lattice point [n,m] (00), and then back to the 阅读全文
posted @ 2013-03-13 16:17 剑不飞 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Bracket sequenceGiven stringsmade up with(,),?, count the way to substitude?with(or)to form regular bracket sequence.InputA strings.(1≤|s|≤1000)OuptutAn integer denotes the number of ways modulo(109+7).Sample input????Sample output2思路:dp[x][y]字符串长为x时,左括号还有y个未匹配。#include #include using namespace std; 阅读全文
posted @ 2013-03-13 12:36 剑不飞 阅读(201) 评论(0) 推荐(0) 编辑
摘要: E. Ivan the Fool VS Gorynych the Dragontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce upon a time in a kingdom far, far away… Okay, let’s start at the point where Ivan the Fool met Gorynych the Dragon. Ivan took out his magic sword and the 阅读全文
posted @ 2013-03-13 09:11 剑不飞 阅读(301) 评论(0) 推荐(0) 编辑
摘要: Longest path on DAGFind the longest path on directed acyclic graphG.InputThe first line contains two integersn,m, which denote the number of vertices and edges.The followingmlines contains two integerai,bi, which denote edgeai→bi.(1≤n≤105,1≤m≤106,1≤ai #include using namespace std; const int mm=6e6+9 阅读全文
posted @ 2013-03-09 16:39 剑不飞 阅读(223) 评论(0) 推荐(0) 编辑
摘要: PackingThe cost of set{(a1,b1),(a2,b2),…,(an,bn)}is defined asmax{ai}×max{bi}Partition set{(a1,b1),(a2,b2),…,(an,bn)}into several non-empty subsets to minimize the sum of the cost of subsets.InputThe first line contains an integern.nlines follow. Each of them contains two integerai,bi.(1≤n≤1000 阅读全文
posted @ 2013-03-09 15:08 剑不飞 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Geometric sumCompute(a+a2+…an)modm.InputThree integersa,n,m.(1≤a,n,m≤1018)OutputThe only integer denotes the result.Sample input2 2 1000000000Sample output6 思路;看代码吧#include #include using namespace std; long long c,x,n; long long mul(long long a,long long b)///(a*b)%c { long long ret=0; a%=c;b%=c;.. 阅读全文
posted @ 2013-03-09 14:23 剑不飞 阅读(246) 评论(0) 推荐(0) 编辑
摘要: American HeritageFarmer John takes the heritage of his cows very seriously. He is not, however, a truly fine bookkeeper. He keeps his cow genealogies as binary trees and, instead of writing them in graphic form, he records them in the more linear `tree in-order' and `tree pre-order' notation 阅读全文
posted @ 2013-03-07 15:58 剑不飞 阅读(331) 评论(0) 推荐(0) 编辑
摘要: C. Dancing Lessonstime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arenpeople taking dancing lessons. Every person is characterized by his/her dancing skillai. At the beginning of the lesson they line up from left to right. While there is at 阅读全文
posted @ 2013-03-05 16:00 剑不飞 阅读(257) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 53 下一页