摘要:Round NumbersTime Limit:2000MSMemory Limit:65536KTotal Submissions:6983Accepted:2384DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) i
阅读全文
摘要:题目链接:http://acm.uestc.edu.cn/problem.php?pid=1307windy数Time Limit:1000 msMemory Limit:65536 kBSolved:104Tried:720SubmitStatusBest SolutionBackDescriptionwindy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。windy想知道,在A和B之间,包括A和B,总共有多少个windy数?Input包含两个整数,A B。满足 1 #include #include #include using namespace
阅读全文
摘要:不要62Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11833Accepted Submission(s): 3691Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 8
阅读全文
摘要:BombTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 3362Accepted Submission(s): 1185Problem DescriptionThe counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bom
阅读全文
摘要:String painterTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1117Accepted Submission(s): 443Problem DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter.
阅读全文
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4255DP的思路就是,如果要访问完[i,j],那么它的子区间一定访问完了。用dp[i][j][0]表示访问完区间[i,j]并留在左端点,dp[i][j][1]表示访问完区间[i,j]并留在右端点。把饭店那个地方也加进去作为点。从饭店那个点往两边进行DP;dp[i][j][0] 可以根据dp[i+1][j][0]和dp[i+1][j][1]得到。dp[i][j][1] 可以根据dp[i][j-1][0]和dp[i][j-1][1]得到。//==============
阅读全文
摘要:题目链接:http://poj.org/problem?id=1651Multiplication PuzzleTime Limit:1000MSMemory Limit:65536KTotal Submissions:5000Accepted:2988DescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and score
阅读全文
摘要:题目链接:http://poj.org/problem?id=2955BracketsTime Limit:1000MSMemory Limit:65536KTotal Submissions:1977Accepted:1012DescriptionWe give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,ifsis a regular brackets sequence, then (s) and [
阅读全文
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1422很简单的区间DP的入门题。一开始这题想了很久就是想不出来。直到做了后面几道区间DP回过来终于想明白了。区间DP可以使用记忆化搜索和直接DP的方法写。这题的状态转移方程:dp[i][j]=min(1+dp[i+1][j],dp[i+1][k-1]+dp[k][j]) ( a[i]==a[k] i<k<=j )注意初始化。/* * Light OJ 1422 - Halloween Costumes * http://lightoj.com/volume_showpro
阅读全文
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4472开始做下区间DP的题目了。题解可以参照大牛博客:http://blog.csdn.net/woshi250hua/article/details/7824433这题很经典,主要是思路:两种写法写的,一种是DP,一种是记忆化搜索。DP一定要注意循环的顺序。代码一://============================================================================// Name : ZOJ.cp...
阅读全文
摘要:Mondriaan's DreamTime Limit:3000MSMemory Limit:65536KTotal Submissions:8974Accepted:5187DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, f
阅读全文
摘要:Most PowerfulTime Limit:2 Seconds Memory Limit:65536 KBRecently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power is produced. Researchers know the way every t
阅读全文
摘要:Islands and BridgesTime Limit:4000MSMemory Limit:65536KTotal Submissions:7685Accepted:1968DescriptionGiven a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it visits each island exactly once. On our map, there is also a p
阅读全文
摘要:炮兵阵地Time Limit:2000MSMemory Limit:65536KTotal Submissions:14519Accepted:5406Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示它能够攻击到的区域:沿
阅读全文
摘要:Corn FieldsTime Limit:2000MSMemory Limit:65536KTotal Submissions:4739Accepted:2506DescriptionFarmer John has purchased a lush new rectangular pasture composed ofMbyN(1 ≤M≤ 12; 1 ≤N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squ
阅读全文
摘要:Prison BreakTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2178Accepted Submission(s): 533Problem DescriptionRompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His t
阅读全文
摘要:TravellingTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2338Accepted Submission(s): 668Problem DescriptionAfter coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on
阅读全文
摘要:Life FormsTime Limit:5000MSMemory Limit:65536KTotal Submissions:7322Accepted:2011DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no human resemblance; thes
阅读全文
摘要:Common SubstringsTime Limit:5000MSMemory Limit:65536KTotal Submissions:5495Accepted:1822DescriptionA substring of a stringTis defined as:T(i,k)=TiTi+1...Ti+k-1, 1≤i≤i+k-1≤|T|.Given two stringsA,Band one integerK, we defineS, a set of triples (i,j,k):S= {(i,j,k) |k≥K,A(i,k)=B(j,k)}.You are to give th
阅读全文
摘要:Maximum repetition substringTime Limit:1000MSMemory Limit:65536KTotal Submissions:5292Accepted:1573DescriptionThe repetition number of a string is defined as the maximum numberRsuch that the string can be partitioned intoRsame consecutive substrings. For example, the repetition number of "ababa
阅读全文
摘要:PalindromeTime Limit:1000MSMemory Limit:16384KB64bit IO Format:%I64d & %I64uSubmitStatusAppoint description:DescriptionThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Ro
阅读全文
摘要:题目链接:http://www.spoj.com/problems/DISUBSTR/694. Distinct SubstringsProblem code: DISUBSTRGiven a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T<=20;Each test case consists of one string, whose length is <= 1000OutputFor each test case output
阅读全文
摘要:Milk PatternsTime Limit:5000MSMemory Limit:65536KTotal Submissions:7586Accepted:3448Case Time Limit:2000MSDescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of mi
阅读全文
摘要:Musical ThemeTime Limit:1000MSMemory Limit:30000KTotal Submissions:14334Accepted:4945DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this representation
阅读全文
摘要:伸展树是比较神奇的,它可以做很多线段树不能实现的事情。最近做伸展树做了好长时间了,现在重新把题目整理下,代码统一些一下呢。说明多是含在代码的注释中。刚开始学,可以看论文,然后按照别人的代码去写。我是参照cxlove大神学习的:http://blog.csdn.net/acm_cxlove/article/details/7815019还有HH的:http://www.notonlysuccess.com/index.php/splay-tree/学习算法只有经过自己不断写了才能完全掌握,代码风格也要适合自己的。1、POJ 3468 A Simple Problem with Integers
阅读全文
摘要:SumsetsTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1030Accepted Submission(s): 406Problem DescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an intege
阅读全文
摘要:Big Event in HDUTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16224Accepted Submission(s): 5725Problem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College h
阅读全文
摘要:Doing HomeworkTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3595Accepted Submission(s): 1424Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of ha
阅读全文
摘要:Get The TreasuryTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1408Accepted Submission(s): 440Problem 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
阅读全文
摘要:PictureTime Limit:2000MSMemory Limit:10000KTotal Submissions:8975Accepted:4741DescriptionA 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 other
阅读全文
摘要:Help with IntervalsTime Limit:6000MSMemory Limit:131072KTotal Submissions:7850Accepted:1818Case 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 LogLoader.
阅读全文
摘要:宠物收养所Time Limit:10000MSMemory Limit:165888KB64bit IO Format:%lld & %lluSubmitStatusAppoint description:Description最近,阿Q开了一间宠物收养所。收养所提供两种服务:收养被主人遗弃的宠物和让新的主人领养这些宠物。 每个领养者都希望领养到自己满意的宠物,阿Q根据领养者的要求通过他自己发明的一个特殊的公式,得出该领养者希望领养的宠物的特点值a(a是一个正整数,a<2^31),而他也给每个处在收养所的宠物一个特点值。这样他就能够很方便的处理整个领养宠物的过程了,宠物收养所总是
阅读全文
摘要:郁闷的出纳员Time Limit:5000MSMemory Limit:65536KB64bit IO Format:%lld & %lluSubmitStatusAppoint description:DescriptionOIER公司是一家大型专业化软件公司,有着数以万计的员工。作为一名出纳员,我的任务之一便是统计每位员工的工资。这本来是一份不错的工作,但是令人郁闷的是,我们的老板反复无常,经常调整员工的工资。如果他心情好,就可能把每位员工的工资加上一个相同的量。反之,如果心情不好,就可能把他们的工资扣除一个相同的量。我真不知道除了调工资他还做什么其它事情。 工资的频繁调整很让员工
阅读全文
摘要:True LiarsTime Limit:1000MSMemory Limit:10000KTotal Submissions:1556Accepted:457DescriptionAfter having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend
阅读全文
摘要:RochambeauTime Limit:5000MSMemory Limit:65536KTotal Submissions:1575Accepted:540DescriptionNchildren are playing Rochambeau (scissors-rock-cloth) game with you. One of them is the judge. The rest children are divided into three groups (it is possible that some group is empty). You don’t know who is
阅读全文
摘要:Connections in Galaxy WarTime Limit:3 Seconds Memory Limit:32768 KBIn order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the Galaxy War began, some tunnels were destroyed by the monsters from another
阅读全文
摘要:How Many Answers Are WrongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1372Accepted Submission(s): 553Problem DescriptionTT and FF are ... friends. Uh... very very good friends -________-bFF is a bad boy, he is always wooing TT to play the follo
阅读全文
摘要:Parity gameTime Limit:1000MSMemory Limit:65536KTotal Submissions:5168Accepted:2028DescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subsequence (for example the subsequence from the third to
阅读全文
摘要:SupermarketTime Limit:2000MSMemory Limit:65536KTotal Submissions:7501Accepted:3148DescriptionA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sale beg
阅读全文
摘要:Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:19259Accepted:9460DescriptionThere 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 university b
阅读全文
摘要:A Bug's LifeTime Limit:10000MSMemory Limit:65536KTotal Submissions:23380Accepted:7603DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender
阅读全文
摘要:Wireless NetworkTime Limit:10000MSMemory Limit:65536KTotal Submissions:13323Accepted:5638DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n
阅读全文
摘要:Cube StackingTime Limit:2000MSMemory Limit:30000KTotal Submissions:15900Accepted:5419Case 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 asks
阅读全文
摘要:Navigation NightmareTime Limit:2000MSMemory Limit:30000KTotal Submissions:3167Accepted:1317Case Time Limit:1000MSDescriptionFarmer John's pastoral neighborhood has N farms (2 <= N <= 40,000), usually numbered/labeled 1..N. A series of M (1 <= M < 40,000) vertical and horizontal roads
阅读全文
摘要:小明系列故事——未知剩余系Time Limit: 500/200 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 594Accepted Submission(s): 123Problem Description “今有物不知其数,三三数之有二,五五数之有三,七七数之有二,问物几何?” 这个简单的谜题就是中国剩余定理的来历。 在艰难地弄懂了这个定理之后,小明开始设计一些复杂的同余方程组X mod ai = bi 来调戏别人,结果是必然的,都失败了。 可是在这个过程中,小明发现有时...
阅读全文
摘要:Find them, Catch themTime Limit:1000MSMemory Limit:10000KTotal Submissions:23816Accepted:7130DescriptionThe 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 whi
阅读全文
摘要:The SuspectsTime Limit:1000MSMemory Limit:20000KTotal Submissions:17128Accepted:8254DescriptionSevere 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 separa
阅读全文
摘要:Is It A Tree?Time Limit:1000MSMemory Limit:10000KTotal Submissions:17328Accepted:5934DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.There is exa
阅读全文
摘要:食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:33631Accepted:9770Description动物王国中有三类动物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句话,这K句
阅读全文