03 2014 档案
摘要:每一个优秀的人,都有一段沉默的时光,那一段时光,是付出了很多努力,忍受孤独和寂寞,不抱怨不诉苦,日后说起时,连自己都能被感动日子。
阅读全文
摘要:Problem 2159 WuYou Accept: 16Submit: 64Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description有两个正整数A和B,这两个数的位数相同且不含前缀0。A的一些位不能够确定,用‘?’代替。已知A...
阅读全文
摘要:Problem 2155 盟国 Accept: 39Submit: 129Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description世界上存在着N个国家,简单起见,编号从0~N-1,假如a国和b国是盟国,b国和c国是盟国,那么a国和c国也是盟国。另外每个国家都有权宣布退盟(注意,退盟后还可以再结盟)。定义下面两个操作:“M X Y” :X国和Y国结盟“S X” :X国宣布退盟 Input多组case。每组case输入一个N和M (1 ≤ N ≤ 100000 , 1 ≤ M ≤ 1000000),N是国家数,M是操作数。接下
阅读全文
摘要:Problem 2154 YesOrNo Accept: 14Submit: 29Time Limit: 1000 mSecMemory Limit : 32768 KB Problem DescriptionA国认为如果字符串a可以通过操作X变成字符串b,就认为是一样的字符串。操作X:将字符串分为两部分,然后调换位置,操作次数不限。W=xy,W’=yx。 Input有多组测试数据,处理到文件结尾。每组测试数据包含两个个字符串(包含英文字符和数字,长度为[1,500000])。 Output对于每组测试数据,如果两个字符串是相同的,输出Yes或者是No。 Sample InputYesOr..
阅读全文
摘要:Problem 2132 LQX的作业 Accept: 67Submit: 150Time Limit: 1000 mSecMemory Limit : 32768 KB Problem DescriptionLQX在做作业时遇到一个难题不会做,请你帮她计算一下:在N个独立地分布于0和1之间的随机变量排为非递减顺序之后,这些变量中第M个小于等于x的概率是多少? Input第一行一个整数T(T 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef __int64 LL; 7 8 LL cnm[52][52]; 9 v.
阅读全文
摘要:Problem 2139 久违的月赛之二 Accept: 42Submit: 106Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description好久没举办月赛了,这次lqw又给大家出了5道题,因为hsy学长宣传的很到位,吸引了n个DDMM们来做,另一位kk学长说,全做对的要给金奖,做对4题要给银奖,做对3题要给铜奖。统计数据的时候,发现每题分别在n个人中有n1、n2、n3、n4、n5个人通过,lqw问kk:“这次难度稍微提高了些,你再猜下,至少会有多少个人获奖?” Input第一行一个数字t,表示有多少组数据,每组数据如下所.
阅读全文
摘要:TwoTime Limit:1000MSMemory Limit:30000KTotal Submissions:1092Accepted:527DescriptionThe city consists of intersections and streets that connect them.H...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef __int64 LL; 7 const LL mod = 1000000007; 8 LL cnm[5002][5002]; 9 LL dp[5002][5002];10 11 void prepare()12 {13 LL i,j;14 for(i=0;i0)39 {40 if(n==0&&a==0&&b==0)break;41 l=a;r=n-b+1;42 for...
阅读全文
摘要:填个空 1 /** 2 3 (a,b) = 质素 4 a [1,A] b [1 ,B]; 5 6 **/ 7 8 #include 9 #include10 #include11 #include12 using namespace std;13 typedef __int64 LL;14...
阅读全文
摘要:Hard WuxingAccepted : 13Submit : 166Time Limit : 1000 MSMemory Limit : 65536 KB题目描述“五行”是中国传统哲学思想,它认为认为大自然的现象由“木、火、土、金、水”这五种气的变化所总括, 不但影响到人的命运,同时也使宇宙万物...
阅读全文
摘要:Easy WuxingAccepted : 25Submit : 124Time Limit : 1000 MSMemory Limit : 65536 KB题目描述“五行”是中国传统哲学思想,它认为认为大自然的现象由“木、火、土、金、水”这五种气的变化所总括, 不但影响到人的命运,同时也使宇宙万物循环不已。 五行具有相生相克的性质,规律如下:五行相克:金克木,木克土,土克水,水克火,火克金。 五行相生:金生水,水生木,木生火,火生土,土生金。 五行任一行与其他五行的关系为:同我、生我、我生、克我、我克。 给你一个1*n的格子,将五行填上去,每格填一个,要求相邻格以及首尾格不能是同我和相克的关
阅读全文
摘要:Bob's ProblemAccepted : 18Submit : 115Time Limit : 1000 MSMemory Limit : 65536 KB题目描述Bob今天碰到一个问题,他想知道x3+y3 = c 是否存在正整数解?输入第一行是一个整数K(K≤20000),表示样例的个数。 以后每行一个整数c(2≤c≤109)输出每行输出一个样例的结果,如果存在,输出“Yes”,否则输出“No”。(引号不用输出)样例输入22827样例输出YesNo哈希 1 #include 2 #include 3 #include 4 #include 5 #include 6 using
阅读全文
摘要:Tree CuttingTime Limit:1000MSMemory Limit:65536KTotal Submissions:3525Accepted:2083DescriptionAfter Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 vectorQ[10
阅读全文
摘要:Balancing ActTime Limit:1000MSMemory Limit:65536KTotal Submissions:8048Accepted:3322DescriptionConsider a tree T with N (1 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 vectorQ[20002];11 int num[20002];12 int dp[20002][2];13 //DP[I][0] 统计子节点的最大个数14 //.
阅读全文
摘要:ComputerTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2679Accepted Submission(s): 1373Problem DescriptionA school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers
阅读全文
摘要:1 一维哈希 2 const int MAX=100007; 3 bool Hash[MAX]; 4 int idx[MAX]; 5 int val[MAX]; 6 7 void Insert(int id,int num) 8 { 9 int k=num%MAX;10 while(Hash[k] && val[k]!=num)11 {12 k++;13 if(k==MAX) k=k-MAX;14 }15 if(!Hash[k])16 {17 Hash[k]=1;18 idx[k...
阅读全文
摘要:魔咒词典Time Limit: 8000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9381Accepted Submission(s): 2405Problem Description哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什
阅读全文
摘要:1356: CatchTime Limit: 2 SecMemory Limit: 128 MBSubmit: 96Solved: 40[Submit][Status][Web Board]DescriptionA thief is running away!We can consider the city where he locates as an undirected graph in which nodes stand for crosses and edges stand for streets. The crosses are labeled from 0 to N–1. The
阅读全文
摘要:1365: Play with ChainTime Limit: 5 SecMemory Limit: 128 MBSubmit: 21Solved: 5[Submit][Status][Web Board]DescriptionYaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the diamonds on the chain is a sequence: 1, 2, 3, …, n.He w
阅读全文
摘要:龟兔赛跑Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10119Accepted Submission(s): 3818Problem Description据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。最近正值HDU举办50周年校庆,社
阅读全文
摘要:Beauty ContestTime Limit:3000MSMemory Limit:65536KTotal Submissions:26087Accepted:8044DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 2 #include 3 #include 4
阅读全文
摘要:Space AntTime Limit:1000MSMemory Limit:10000KTotal Submissions:2830Accepted:1815DescriptionThe most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y1999 and called it M11. It has only one eye on the left side of it
阅读全文
摘要:WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:28112Accepted:9383DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a b
阅读全文
摘要:Surround the TreesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6728Accepted Submission(s): 2556Problem DescriptionThere are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minima
阅读全文
摘要:The order of a TreeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 917Accepted Submission(s): 496Problem DescriptionAs we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1.insert a key k to
阅读全文