08 2013 档案

摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13051305: SubstringTime Limit: 2 Sec Memory Limit: 10 MB Submit: 12 Solved: 2 [Submit][Status][Web Board]DescriptionGiven a string s. The length of s is smaller than 1000. You are to caculate the number of different substrings of s.InputThere are mult 阅读全文
posted @ 2013-08-31 21:50 crazy_apple 阅读(406) 评论(0) 推荐(1)
摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13061306: ManorTime Limit: 1 Sec Memory Limit: 128 MB Submit: 125 Solved: 35 [Submit][Status][Web Board]DescriptionBob有n个正整数,他将这n个整数根据大小划分成两部分。对于小于等于k的整数放在集合A中,其余的放在集合B中。每次他从集合B中取出一个最大的值,将其变成0放入A集合中。然后将A集合中所有的元素都增加a,如果此时A中元素大于k,那么要将该元素放入B中,同时将B集合中剩余的元 阅读全文
posted @ 2013-08-31 21:17 crazy_apple 阅读(287) 评论(0) 推荐(0)
摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13121312: 榜单Time Limit: 1 Sec Memory Limit: 128 MB Submit: 222 Solved: 84 [Submit][Status][Web Board]DescriptionZZY很喜欢流行音乐,每周都要跟踪世界各地各种榜单,例如Oricon和Billboard,现在给出每周各个单曲的销量请给出每周的TOP5以及TOP5中各个单曲的浮动情况。量的排名是按照本周销量排名,而不是总销量。浮动情况则是较上周的排名变动,也就是说即使某单曲本周销量比上周的差 阅读全文
posted @ 2013-08-31 21:13 crazy_apple 阅读(202) 评论(0) 推荐(0)
摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=13031303: DecimalTime Limit: 1 Sec Memory Limit: 128 MB Submit: 589 Solved: 61 [Submit][Status][Web Board]Description任意一个分数都是有理数,对于任意一个有限小数,我们都可以表示成一个无限循环小数的形式(在其末尾添加0),对于任意一个无限循环小数都可以转化成一个分数。现在你的任务就是将任意一个无限循环小数转化成既约分数形式。所谓既约分数表示,分子和分母的最大公约数是1。Input有多 阅读全文
posted @ 2013-08-31 21:09 crazy_apple 阅读(279) 评论(0) 推荐(0)
摘要:http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11353 1 #include 2 #include 3 #include 4 #include 5 #define PI acos(-1) 6 //using namespace std; 7 struct Nod 8 { 9 int dir; 10 int len; 11 }node[200]; 12 struct Point 13 { 14 double x; 15 double y; 16 }; 17 struct segmemt ... 阅读全文
posted @ 2013-08-30 16:50 crazy_apple 阅读(201) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2262Goldbach's ConjectureTime Limit:1000MSMemory Limit:65536KTotal Submissions:34323Accepted:13169DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every even number greater 阅读全文
posted @ 2013-08-23 10:46 crazy_apple 阅读(343) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3207Ikki's Story IV - Panda's TrickTime Limit:1000MSMemory Limit:131072KTotal Submissions:7021Accepted:2604Descriptionliympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such ea 阅读全文
posted @ 2013-08-21 11:34 crazy_apple 阅读(297) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1094Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:24505Accepted:8487DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, th 阅读全文
posted @ 2013-08-19 20:52 crazy_apple 阅读(246) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2226Muddy FieldsTime Limit:1000MSMemory Limit:65536KTotal Submissions:7078Accepted:2622DescriptionRain has pummeled the cows' field, a rectangular grid of R rows and C columns (1 8 #include 9 #include 10 #include 11 #include 12 13 #define N 55 14 #define M N*N 15 using 阅读全文
posted @ 2013-08-19 16:27 crazy_apple 阅读(710) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3041AsteroidsTime Limit:1000MSMemory Limit:65536KTotal Submissions:12601Accepted:6849DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 8 #include 9 #include10 #include11 #include12 13 #define N 55014 using. 阅读全文
posted @ 2013-08-19 15:07 crazy_apple 阅读(259) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2060Taxi Cab SchemeTime Limit:1000MSMemory Limit:30000KTotal Submissions:5459Accepted:2286DescriptionRunning a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a ca 阅读全文
posted @ 2013-08-19 10:47 crazy_apple 阅读(434) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2728Desert KingTime Limit:3000MSMemory Limit:65536KTotal Submissions:18595Accepted:5245DescriptionDavid the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every villag 阅读全文
posted @ 2013-08-17 13:13 crazy_apple 阅读(377) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2449Remmarguts' DateTime Limit:4000MSMemory Limit:65536KTotal Submissions:18168Accepted:4984Description"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story.& 阅读全文
posted @ 2013-08-16 16:28 crazy_apple 阅读(550) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3463SightseeingTime Limit:2000MSMemory Limit:65536KTotal Submissions:6420Accepted:2270DescriptionTour operator Your Personal Holiday organises guided bus trips across the Benelux. Every day the bus moves from one citySto another cityF. On this way, the tourists in the bus c 阅读全文
posted @ 2013-08-15 17:25 crazy_apple 阅读(560) 评论(0) 推荐(0)
摘要:http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=3237Problem H:Boring CountingTime Limit: 3 Sec Memory Limit: 128 MB Submit: 8 Solved: 4 [Submit][Status][Discuss]DescriptionIn this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. Now you 阅读全文
posted @ 2013-08-15 14:28 crazy_apple 阅读(594) 评论(0) 推荐(0)
摘要:2013年"浪潮杯"山东省第四届ACM大学生程序设计竞赛排名:http://acm.upc.edu.cn/ranklist/一、第J题坑爹大水题,模拟一下就行了J:Contest Print Server【题解】: 题目大意:输入n,s,x,y,mod 分别队伍数n,还有一个s生成函数 s=((s*x)+y)%mod,就是打印机根据要求打印纸张,打印到s时,打印机将重置,生成新的s【code】: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int t; 9 ... 阅读全文
posted @ 2013-08-14 11:32 crazy_apple 阅读(371) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3522Slim SpanTime Limit:5000MSMemory Limit:65536KTotal Submissions:5666Accepted:2965DescriptionGiven an undirected weighted graphG, you should find one of spanning trees specified as follows.The graphGis an ordered pair (V,E), whereVis a set of vertices {v1,v2, …,vn} andEis 阅读全文
posted @ 2013-08-13 10:48 crazy_apple 阅读(425) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1236Network of SchoolsTime Limit:1000MSMemory Limit:10000KTotal Submissions:9481Accepted:3767DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distribut 阅读全文
posted @ 2013-08-12 17:08 crazy_apple 阅读(265) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2762Going from u to v or from v to u?Time Limit:2000MSMemory Limit:65536KTotal Submissions:12733Accepted:3286DescriptionIn order to make their sons brave, Jiajia and Wind take them to a big cave. The cave has n rooms, and one-way corridors connecting some rooms. Each time, 阅读全文
posted @ 2013-08-11 20:23 crazy_apple 阅读(267) 评论(0) 推荐(0)
摘要:题目地址:http://poj.org/problem?id=2553The Bottom of a GraphTime Limit:3000MSMemory Limit:65536KTotal Submissions:7881Accepted:3263DescriptionWe will use the following (standard) definitions from graph theory. LetVbe a nonempty and finite set, its elements being called vertices (or nodes). LetEbe a subs 阅读全文
posted @ 2013-08-10 18:00 crazy_apple 阅读(280) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2186Popular CowsTime Limit:2000MSMemory Limit:65536KTotal Submissions:20191Accepted:8193DescriptionEvery cow's dream is to become the most popular cow in the herd. In a herd of N (1 7 #include 8 #include 9 #include 10 #include 11 #include 12 13 #define N 10010 14 using. 阅读全文
posted @ 2013-08-10 17:16 crazy_apple 阅读(234) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 #define N 1000 9 10 using namespace std;11 12 int pre[N],lowlink[N],sccno[N],dfn_clock,scc_cnt;13 14 stack stk;15 16 vector G[N];17 18 void DFN(int u)19 {20 pre[u] = lowlink[u] = ++dfn_clock; //时间戳21 stk.push(u);22 ... 阅读全文
posted @ 2013-08-10 11:50 crazy_apple 阅读(196) 评论(0) 推荐(0)
摘要:有向图强连通分量的Tarjan算法[有向图强连通分量]在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected)。如果有向图G的每两个顶点都强连通,称G是一个强连通图。非强连通图有向图的极大强连通子图,称为强连通分量(strongly connected components)。下图中,子图{1,2,3,4}为一个强连通分量,因为顶点1,2,3,4两两可达。{5},{6}也分别是两个强连通分量。直接根据定义,用双向遍历取交集的方法求强连通分量,时间复杂度为O(N^2+M)。更好的方法是Kosaraju算法或Tarjan算法,两者的时间复杂度都是O(N 阅读全文
posted @ 2013-08-10 11:48 crazy_apple 阅读(219) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3013Big Christmas TreeTime Limit:3000MSMemory Limit:131072KTotal Submissions:19009Accepted:4048DescriptionChristmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture. 阅读全文
posted @ 2013-08-09 18:46 crazy_apple 阅读(317) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1679The Unique MSTTime Limit:1000MSMemory Limit:10000KTotal Submissions:17726Accepted:6150DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning t 阅读全文
posted @ 2013-08-08 16:57 crazy_apple 阅读(407) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1659Frogs' NeighborhoodTime Limit:5000MSMemory Limit:10000KTotal Submissions:6050Accepted:2623Special JudgeDescription未名湖附近共有N个大小湖泊L1,L2, ...,Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤i≤N)。如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居。现在已知每只青蛙的邻居数目x1,x2, ...,xn,请你给出每两个湖泊之间的相连关系。Input第一行是测试数据的组数T 阅读全文
posted @ 2013-08-07 18:26 crazy_apple 阅读(241) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3249Test for JobTime Limit:5000MSMemory Limit:65536KTotal Submissions:8206Accepted:1831DescriptionMr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have a job, since there are swelling num 阅读全文
posted @ 2013-08-07 16:26 crazy_apple 阅读(355) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 #define N 10000 6 using namespace std; 7 8 void Merge(int *b,int *a,int i,int m,int n) 9 {10 int s = i;11 int j,k;12 //归并13 for(j=m+1,k=i;i>1;33 MergeSort(b,a,s,mid); 34 MergeSort(b,a,mid+1,t);35 Merge(b,a,s,mid,t); //... 阅读全文
posted @ 2013-08-06 22:33 crazy_apple 阅读(502) 评论(0) 推荐(0)
摘要:随机函数生成一个超大数组:【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 int main()10 {11 freopen("random.txt","w",stdout);12 int n;13 scanf("%d",&n);14 int i;15 srand(time(NULL));16 printf("%d\n",n);17 for(i=0;i 2 #include 阅读全文
posted @ 2013-08-06 19:04 crazy_apple 阅读(415) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int partition(int *a,int left,int right) 8 { 9 a[0] = a[left]; //设置a[left]为主键值,存于a[0],即以a[left]值将[left,right]区间一分为二10 while(left=a[0]) right--; //从右边开始找到比主键值a[0]小的值,移到左边13 a[left]=a[right];14 while(left<right&... 阅读全文
posted @ 2013-08-06 17:31 crazy_apple 阅读(2198) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3277City HorizonTime Limit:2000MSMemory Limit:65536KTotal Submissions:15255Accepted:4111DescriptionFarmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildi 阅读全文
posted @ 2013-08-06 13:15 crazy_apple 阅读(496) 评论(0) 推荐(0)
摘要:http://acm.fzu.edu.cn/problem.php?pid=2105Problem DescriptionGiven N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations:Operation 1: AND opn L RHere opn, L and R are integers.For L≤i≤R, we do A[i]=A[i] AND opn (here "AND" is bitwise operation).Operation 2: OR opn L RHere opn, 阅读全文
posted @ 2013-08-05 21:57 crazy_apple 阅读(886) 评论(0) 推荐(1)
摘要:http://poj.org/problem?id=3468A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:46488Accepted:13633Case Time Limit:2000MSDescriptionYou haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to 阅读全文
posted @ 2013-08-04 22:33 crazy_apple 阅读(222) 评论(0) 推荐(0)
摘要:题目地址:http://poj.org/problem?id=2777Count ColorTime Limit:1000MSMemory Limit:65536KTotal Submissions:30995Accepted:9285DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board wit 阅读全文
posted @ 2013-08-04 16:49 crazy_apple 阅读(263) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3667HotelTime Limit:3000MSMemory Limit:65536KTotal Submissions:9484Accepted:4066DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, 阅读全文
posted @ 2013-08-03 23:36 crazy_apple 阅读(242) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3333Turing TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2614 Accepted Submission(s): 892 Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about interva 阅读全文
posted @ 2013-08-03 21:01 crazy_apple 阅读(444) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3308LCISTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2959 Accepted Submission(s): 1287 Problem DescriptionGiven n integers. You have two operations: U A B: replace the Ath number by B. (index counting 阅读全文
posted @ 2013-08-03 17:02 crazy_apple 阅读(282) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2528Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:34372Accepted:9954DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim 阅读全文
posted @ 2013-08-03 12:46 crazy_apple 阅读(242) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2828Buy TicketsTime Limit:4000MSMemory Limit:65536KTotal Submissions:10478Accepted:5079DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Li 阅读全文
posted @ 2013-08-02 17:23 crazy_apple 阅读(1274) 评论(1) 推荐(1)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1540Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3168 Accepted Submission(s): 1216 Problem DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensivel 阅读全文
posted @ 2013-08-02 10:21 crazy_apple 阅读(652) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1754I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 26663 Accepted Submission(s): 10596 Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老 阅读全文
posted @ 2013-08-01 16:45 crazy_apple 阅读(247) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1698Just a HookTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 12534 Accepted Submission(s): 6242 Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of 阅读全文
posted @ 2013-08-01 16:17 crazy_apple 阅读(227) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2795BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7320 Accepted Submission(s): 3281 Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h i 阅读全文
posted @ 2013-08-01 12:26 crazy_apple 阅读(136) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1828PictureTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2135 Accepted Submission(s): 1134 Problem DescriptionA number of rectangular posters, photographs and other pictures of the same shape are pasted 阅读全文
posted @ 2013-08-01 10:54 crazy_apple 阅读(264) 评论(0) 推荐(0)