摘要:Turing TreeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1973Accepted Submission(s): 654Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solu
阅读全文
摘要:Man DownTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1146Accepted Submission(s): 393Problem Des...
阅读全文
摘要:FarmingTime Limit: 12000/6000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 633Accepted Submission(s): 168Problem DescriptionYou have a big farm, and you want to grow vegetables in it. You're too lazy to seed the seeds yourself, so you've hired n people to do
阅读全文
摘要:Get The TreasuryTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1036Accepted Submission(s): 318Problem DescriptionJack knows that there is a great underground treasury in a secret region. And he has a special device that can be used to detect trea
阅读全文
摘要:Tian Ji -- The Horse RacingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10782Accepted Submission(s): 2992Problem DescriptionHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the
阅读全文
摘要:Matrix Chain MultiplicationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 620Accepted Submission(s): 426Problem DescriptionMatrix multiplication problem is a typical example of dynamical programming. Suppose you have to evaluate an expression like
阅读全文
摘要:Word AmalgamationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1583Accepted Submission(s): 729Problem DescriptionIn millions of newspapers across the United States there is a word game called Jumble. The object of this game is to solve a riddle,
阅读全文
摘要:Watashi's BGTime Limit: 3 Seconds Memory Limit: 65536 KBWatashi is the couch of ZJU-ICPC Team and he is very kind hearted. In ZJU-ICPC summer training camp, students are divided into several groups and each day one of the groups will design some problems to hold a contest. Today students of Grou
阅读全文
摘要:Magic NumberTime Limit: 2 Seconds Memory Limit: 32768 KBA positive number y is called magic number if for every positive integer x it satisfies that put y to the right of x, which will form a new integer z, z mod y = 0.InputThe input has multiple cases, each case contains two positve integers m, ...
阅读全文
摘要:FactorialTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1651Accepted Submission(s): 1062Problem DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this t
阅读全文
摘要:Stars in Your WindowTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7250Accepted: 1942DescriptionFleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I saw you sm
阅读全文
摘要:昂贵的聘礼Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 26818Accepted: 7477Description年 轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿 不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要 5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其
阅读全文
摘要:Hat’s WordsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3431Accepted Submission(s): 1303Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the ha
阅读全文
摘要:JohnTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1312Accepted Submission(s): 683Problem DescriptionLittle John is playing very funny game with his younger brother. There is one big box filled with M&Ms of different colors. At first John has
阅读全文
摘要:Minimum Transport CostTime Limit: 2 Seconds Memory Limit: 65536 KBThese are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transportation fee consists of two part...
阅读全文
摘要:Bus SystemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3746Accepted Submission(s): 943Problem DescriptionBecause of the huge population of China, public transportation is very important. Bus is an important transportation method in traditional p
阅读全文
摘要:Game of Life Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVALive 4034DescriptionLIFE is a evolutionary game played on a 2D game board. Initially, the game board is filled with white and black stones. For each iteration of the game, each stone is checked
阅读全文
摘要:A - Miss Kitty and Her Little Ice Cream Shop Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVALive 4033DescriptionMiss Kitty graduated from University N that has a long history of training their students to become teachers in an island country T. All of he
阅读全文
摘要:ZOJ Problem Set - 1244Definite ValuesTime Limit: 2 Seconds Memory Limit: 65536 KBA common error in programming is to use variables that have not been initialized before. For example, in C and C++, all variables have an indefinite value after declaration - their value can be anything. Thus, the fo...
阅读全文
摘要:FrogTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 492Accepted Submission(s): 221Problem DescriptionA little frog named Fog is on his way home. The path's length is N (1 <= N <= 100), and there are many insects along the way. Suppose the
阅读全文
摘要:小孩报数问题Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7211Accepted: 3437Description有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N<=64) 接下来每行输入一个小孩的名字(人名不超过15个字符)最后一行输入W,S (W < N),用逗号","间隔Outpu
阅读全文
摘要:GCD AgainTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1391Accepted Submission(s): 518Problem DescriptionDo you have spent some time to think and try to solve those unsolved problem after one ACM contest?No? Oh, you must do this when you want to
阅读全文
摘要:覆盖的面积Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2218Accepted Submission(s): 1093Problem Description给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮
阅读全文
摘要:PostersTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2569Accepted Submission(s): 564Problem DescriptionTed has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside.
阅读全文
摘要:Count ColorTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 26788Accepted: 8003DescriptionChosen 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 with length L centimeter, L is a
阅读全文
摘要:PictureTime Limit: 2000MSMemory Limit: 10000KTotal Submissions: 8215Accepted: 4347DescriptionA number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially or totally covered by the o
阅读全文
摘要:Number GameTime Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 30Accepted Submission(s) : 10Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description有上下两个圆圈,每个圆圈边沿上均匀分布有N个点。上圆和下圆的点用一条竖直的直线连起来。将连续的自然数1到N,这N个数按逆时针方向放到下圆那N个不 同的点上。将连续的自然数N+
阅读全文
摘要:蛋疼的英语Time Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 23Accepted Submission(s) : 12Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Descriptionjxust_acm 队的同学都知道Xianbin5的英语特别差,因而他每次比赛都要队友来给他翻译题目,然而现在队友回家了,他为了提高英语,决定看一篇很长的英文文章, 文章有N个单词(0#
阅读全文
摘要:最大因子数Time Limit : 10000/5000ms (Java/Other)Memory Limit : 65535/65535K (Java/Other)Total Submission(s) : 35Accepted Submission(s) : 16Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description 定义f(n)为整数n的因子数,如f(9) = 3(分别是1,3,9).定义g(n)=k,整数k是满足f(k) = max{f(i)|0#include #include #inclu
阅读全文
摘要:七夕节Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18102Accepted Submission(s): 5396Problem Description七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!"人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2
阅读全文
摘要://发现了一种写起来方便的素数筛选法、速度也够快//比用sqrt写函数判断快噢#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#define N 1000000using namespace std;bool hash[N];int main(){ int i,j=0; for(j=4;j<N;j+=2) hash[j]=1; for(i=3;i<1000;i+=2) if(!hash[i])//在这里面就可以直接收集素数放在数组里
阅读全文
摘要:AtlantisTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 11830Accepted: 4588DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe different
阅读全文
摘要:亲和串Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3732Accepted Submission(s): 1670Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。 亲和串的定义是这样...
阅读全文
摘要:循环多少次?Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1686Accepted Submission(s): 603Problem Description我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如,如果代码中出现for(i=1;i#include #include using namespace std;int dp[2003][2003];void set(){ int i,j; for(i=1;i&l
阅读全文
摘要:Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2273Accepted Submission(s): 837Probl...
阅读全文
摘要:Raising Modulo NumbersTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3553Accepted: 1962DescriptionPeople are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathemat
阅读全文
摘要:Sequence operationTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3114Accepted Submission(s): 909Problem Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's.We have five operations here:Change operatio
阅读全文
摘要:汉诺塔 XTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 294Accepted Submission(s): 175Problem Description1,2,...,n表示n个盘子.数字大盘子就大.n个盘子放在第1根柱子上.大盘不能放在小盘上.在第1根柱子上的盘子是a[1],a[2],...,a[n]. a[1]=n,a[2]=n-1,...,a[n]=1.即a[1]是最下面的盘子.把n个盘子移动到第3根柱子.每次只能移动1个盘子,且大盘
阅读全文
摘要:汉诺塔IXTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 404Accepted Submission(s): 235Problem Description1,2,...,n表示n个盘子.数字大盘子就大.n个盘子放在第1根柱子上.大盘不能放在小盘上. 在第1根柱子上的盘子是a[1],a[2],...,a[n]. a[1]=n,a[2]=n-1,...,a[n]=1.即a[1]是最下 面的盘子.把n个盘子移动到第3根柱子.每次只能移动1个盘子,且
阅读全文
摘要:RelativesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8923Accepted: 4184DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a =
阅读全文
摘要:Brave balloonistsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4546Accepted: 1924DescriptionTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork mak
阅读全文
摘要:Smith NumbersTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 10002Accepted: 3512DescriptionWhile skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property:
阅读全文
摘要:A/BTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 592Accepted Submission(s): 475Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。O
阅读全文
摘要:HotelTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 6681Accepted: 2777DescriptionThe 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, has named the Bullmoose Ho
阅读全文
摘要:Another LCISTime Limit: 1000 ms Memory Limit: 65536 kB Solved: 111 Tried: 1673 SubmitStatusBest SolutionBackDescription For a sequence S1,S2,...,SN, and a pair of integers (i, j), if 1 <= i <= j <= N and Si < Si+1 < Si+2 <...< Sj-1 < Sj, then the sequence Si,Si+1,...,Sj is a
阅读全文
摘要:BeansTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1433Accepted Submission(s): 741Problem DescriptionBean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is only one bean
阅读全文
摘要:LCISTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1611Accepted Submission(s): 717Problem DescriptionGiven n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the longest consec
阅读全文
摘要:The sum problemTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9078Accepted Submission(s): 2776Problem DescriptionGiven a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.InputInp
阅读全文
摘要:Horizontally Visible SegmentsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 2188Accepted: 818DescriptionThere is a number of disjoint vertical line segments in the plane. We say that two segments are horizontally visible if they can be connected by a horizontal line segment that does not h
阅读全文
摘要:Help with IntervalsTime Limit: 6000MSMemory Limit: 131072KTotal Submissions: 6278Accepted: 1391Case Time Limit: 2000MSDescriptionLogLoader, Inc. is a company specialized in providing products for analyzing logs. While Ikki is working on graduation design, he is also engaged in an internship at LogLo
阅读全文
摘要:Mayor's postersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 26695Accepted: 7711DescriptionThe 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. The city council has fin
阅读全文
摘要:A Simple Problem with IntegersTime Limit: 5000MSMemory Limit: 131072KTotal Submissions: 31956Accepted: 9089Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a giv
阅读全文
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8450Accepted Submission(s): 4090Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecut
阅读全文
摘要:Buy TicketsTime Limit: 4000MSMemory Limit: 65536KTotal Submissions: 7553Accepted: 3599DescriptionRailway 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 Little Cat still had schedule
阅读全文
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3670Accepted Submission(s): 1738Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the
阅读全文
摘要:Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3973Accepted Submission(s): 2380Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai
阅读全文
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15716Accepted Submission(s): 6099Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15926Accepted Submission(s): 6983Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数
阅读全文
摘要:Feed the dogsTime Limit: 6000MSMemory Limit: 65536KTotal Submissions: 11808Accepted: 3409DescriptionWind loves pretty dogs very much, and she has n pet dogs. So Jiajia has to feed the dogs every day for Wind. Jiajia loves Wind, but not the dogs, so Jiajia use a special way to feed the dogs. At lunch
阅读全文
摘要:Double QueueTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6090Accepted: 2866DescriptionThe new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using modern information technologies.
阅读全文
摘要:六度分离Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1360Accepted Submission(s): 528Problem Description1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degree
阅读全文
摘要:最短路径问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4184Accepted Submission(s): 1249Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是
阅读全文
摘要:Internet BandwidthOn the Internet, machines (nodes) are richly interconnected, and many paths may exist between a given pair of nodes. The total message-carrying capacity (bandwidth) between two given nodes is the maximal amount of data per unit time that can be transmitted from one node to the oth.
阅读全文
摘要:Connect the CitiesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4014Accepted Submission(s): 1193Problem Description In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but.
阅读全文
摘要:Flow ProblemTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2857Accepted Submission(s): 1348Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted dire
阅读全文
摘要:HDU TodayTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5703Accepted Submission(s): 1384Problem Description经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不
阅读全文
摘要:A+B ComingTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3359Accepted Submission(s): 2087Problem DescriptionMany classmates said to me that A+B is must needs.If you can’t AC this problem, you would invite me for night meal. ^_^InputInput may conta
阅读全文
摘要:NetworkingTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4457Accepted: 2421DescriptionYou are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pairs of point
阅读全文
摘要:Sum of Consecutive Prime NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13616Accepted: 7590DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integ
阅读全文
摘要:回文字符串时间限制:3000 ms | 内存限制:65535 KB难度:4描述所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba"。当然,我们给你的问题不会再简单到判断一个字符串是不是回文字符串。现在要求你,给你一个字符串,可在任意位置添加字符,最少再添加几个字符,可以使这个字符串成为回文字符串。输入第一行给出整数N(0<N<100)接下来的N行,每行一个字符串,每个字符串长度不超过1000.输出每行输出所需添加的最少字符数样例输入1Ab3bd样例输出2来源IOI 2000上传者//很神奇的一道动态规划,//输入字符串后,逆序,然后
阅读全文
摘要:2 6 4 1 3 7 0 5 88 1 5 7 3 6 4 0 231treap sbt splay//今天写的八数码 速度不行呀、老超时、照着白皮书写的#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <queue>#define MAXSIZE 362888using namespace std;typedef int State[9];State st[MAXSIZE],goal;int dis[MAXSIZ
阅读全文
摘要:2^x mod n = 1Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6543Accepted Submission(s): 1961Problem DescriptionGive a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.InputOne positive integer on each line, the value of n.OutputIf
阅读全文
摘要:Jessica's Reading ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5592Accepted: 1646DescriptionJessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to ma
阅读全文
摘要:EqsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 8484Accepted: 4187DescriptionConsider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifi
阅读全文
摘要:Ping pongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1786Accepted Submission(s): 644Problem DescriptionN(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill r
阅读全文
摘要:The Number of setTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 722Accepted Submission(s): 437Problem Description Given you n sets.All positive integers in sets are not less than 1 and not greater than m.If use these sets to combinate the new set,
阅读全文
摘要:A simple problemTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1946Accepted Submission(s): 665Problem DescriptionZty很痴迷数学问题.。一天,yifenfei出了个数学题想难倒他,让他回答1 / n。但Zty却回答不了^_^. 请大家编程帮助他.Input第一行整数T,表示测试组数。后面T行,每行一个整数 n (1#include int hash[100000];int m.
阅读全文
摘要:EquationsTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2879Accepted Submission(s): 1114Problem DescriptionConsider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of the
阅读全文
摘要:命运Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3941Accepted Submission(s): 1408Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执
阅读全文
摘要:于PAT/ACM培训的报名通知~ AssignmentsTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1075Accepted Submission(s): 488Problem DescriptionIn a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A needs
阅读全文
摘要:FriendshipTime Limit: 3 Seconds Memory Limit: 32768 KB A friend is like a flower,a rose to be exact,Or maybe like a brand new gatethat never comes unlatched.A friend is like an owl,both beautiful and wise.Or perhaps a friend is like a ghost,whose spirit never dies.A friend is like a heart that go...
阅读全文
摘要:FrecklesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5217Accepted: 2706DescriptionIn an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of the Liberty Bell. Alas, one of the freckles turns out to be a scar, so his Ripley'
阅读全文
摘要:Find them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 21108Accepted: 6259DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify
阅读全文
摘要:NetworkTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10104Accepted: 3796Special JudgeDescriptionAndrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the company, they can be connected to each other using cables. Since
阅读全文
摘要:食物链Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 29454Accepted: 8591Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句
阅读全文
摘要:Cube StackingTime Limit: 2000MSMemory Limit: 30000KTotal Submissions: 14175Accepted: 4773Case Time Limit: 1000MSDescriptionFarmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John
阅读全文
摘要:CoursesTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1888Accepted Submission(s): 848Problem DescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is
阅读全文
摘要:Drainage DitchesTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 40193Accepted: 14964DescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regr
阅读全文
摘要:kiki's gameTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 40000/1000 K (Java/Others)Total Submission(s): 3365Accepted Submission(s): 1952Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of th
阅读全文
摘要:FibonacciTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6065Accepted: 4246DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative formul
阅读全文
摘要:Digital RootsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29353Accepted Submission(s): 8974Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then tha
阅读全文
摘要:Farm IrrigationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2492Accepted Submission(s): 1107Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are
阅读全文
摘要:More is betterTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 327680/102400 K (Java/Others)Total Submission(s): 5725Accepted Submission(s): 2127Problem DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be.
阅读全文
摘要:How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5629Accepted Submission(s): 2662Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he need
阅读全文
摘要:RailsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 18531Accepted: 7391DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to establish
阅读全文
摘要:SequenceTime Limit: 6000MSMemory Limit: 65536KTotal Submissions: 5137Accepted: 1572DescriptionGiven m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It's clear that we may get n ^ m this kind of sequences. Then
阅读全文
摘要:ZOJ Problem Set - 3433Gu Jian Qi TanTime Limit: 2 Seconds Memory Limit: 65536 KBGu Jian Qi Tan is a very hot Chinese RPG in this summer vacation. SuSu is the most important role in the game. When SuSu first meet the ancient dragon QianYu, he will have a very difficult battle with QianYu. In order...
阅读全文
摘要:ZOJ Problem Set - 3410Layton's EscapeTime Limit: 2 Seconds Memory Limit: 65536 KBProfessor Layton is a renowned archaeologist from London's Gressenheller University. He and his apprentice Luke has solved various mysteries in different places.Unfortunately, Layton and Luke are trapped in a py
阅读全文
摘要:ZOJ Problem Set - 3230Solving the ProblemsTime Limit: 2 Seconds Memory Limit: 32768 KBProgramming is fun, Aaron is addicted to it. In order to improve his programming skill, he decides to solve one programming problem per day. As you know, different problems have different properties, some proble...
阅读全文
摘要:Fence RepairTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 15047Accepted: 4799DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ≤
阅读全文
摘要:StripiesTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 9301Accepted: 4527DescriptionOur chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian - polosatiki, but the scientists had to invent an English name to apply for a
阅读全文
摘要:RescueTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8065Accepted Submission(s): 2959Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs,
阅读全文
摘要:StonesTime Limit: 5000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 374Accepted Submission(s): 217Problem DescriptionBecause of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a littl
阅读全文
摘要:Windows Message QueueTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1686Accepted Submission(s): 637Problem DescriptionMessage queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something ha
阅读全文
摘要:【Hot】关于PAT/ACM培训的报名通知~ 看病要排队Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2752Accepted Submission(s): 1101Problem Description看病要排队这个是地球人都知道的常识。不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同
阅读全文
摘要:http://acm.nyist.net/JudgeOnline/problem.php?pid=117求逆序数时间限制:2000 ms | 内存限制:65535 KB难度:5描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个整数T表示测试数据的组数(1<=T<=5)每组测试数据的每一行是一个整数N表示数列中共有N个元素(2〈=N〈=1000000)随后的一行共有N个整数Ai(0
阅读全文
摘要:Pseudoprime numbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4864Accepted: 1872DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not ve
阅读全文
摘要:Balanced LineupTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 22573Accepted: 10499Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with som
阅读全文
摘要:Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 17089Accepted: 8283DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your universi
阅读全文
摘要:Prime CutsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 8245Accepted: 3151DescriptionA prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that will cut some number of prime numbers from the list of pri
阅读全文
摘要:Prime GapTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 6597Accepted: 3775DescriptionThe sequence of n − 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numbers p and p + n is called a prime gap of length n. For e
阅读全文
摘要:Graph’s Cycle ComponentTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1275Accepted Submission(s): 499Problem DescriptionIn graph theory, a cycle graph is an undirected graph that consists of a single cycle, or in other words, some number of verti
阅读全文
摘要:A strange liftTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5644Accepted Submission(s): 2073Problem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.T
阅读全文
摘要:The SuspectsTime Limit: 1000MSMemory Limit: 20000KTotal Submissions: 14589Accepted: 6957DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to se
阅读全文