摘要:The ClocksTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12403Accepted: 4908Description|-------| |-------| |-------|| | | | | | ||---O | |---O | | O || | | | | ||-------| |-------| |-------| A B ...
阅读全文
摘要:Widget FactoryTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 3412Accepted: 1114DescriptionThe widget factory produces several different kinds of widgets. Each widget is carefully built by a skilled widgeteer. The time required to build a widget depends on its type: the simple widgets need
阅读全文
摘要:The Water BowlsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3340Accepted: 1298DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which holds no water)
阅读全文
摘要:开关问题Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 4016Accepted: 1399Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系的开关的状态如果原来为开就变为关,如果为关就变为开。你的目标是经过若干次开关操作后使得最后N个开关达到一个特定的状态。对于任意一个开关,最多只能进行一次开关操作。你的任务是,计算有多少种可以达到指定状态的方法。(不计开关操作的顺序)Input输入第一行有一个数K,表示以下有K组测
阅读全文
摘要:Flip GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 20103Accepted: 8710DescriptionFlip game is played on a rectangular 4x4 field with tw...
阅读全文
摘要:Painter's ProblemTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3441Accepted: 1696DescriptionThere is a square wall which is made of n*n small square bricks. Some bricks are white while some bricks are yellow. Bob is a painter and he wants to paint all the bricks yellow. But there is s
阅读全文
摘要:EXTENDED LIGHTS OUTTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4669Accepted: 3073DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each (the actual puzzle has 5 rows of 5 buttons each). Each button has a light. When a button is pressed, that
阅读全文
摘要:Dragon BallsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1201Accepted Submission(s): 484Problem DescriptionFive hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gath
阅读全文
摘要:Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1830Accepted Submission(s): 634Problem DescriptionHoledox is a small animal which can be considered as one point. It lives in a straight pipe whose length is L. Holedox can only move alo
阅读全文
摘要:Divide ChocolateTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1061Accepted Submission(s): 505Problem DescriptionIt is well known that claire likes dessert very much, especially chocolate. But as a girl she also focuses on the intake of calories e
阅读全文
摘要:SubsequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2641Accepted Submission(s): 869Problem DescriptionThere is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference betwee
阅读全文
摘要:Simpsons’ Hidden TalentsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 939Accepted Submission(s): 321Problem DescriptionHomer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Homer: T
阅读全文
摘要:Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1255Accepted Submission(s): 538Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are on
阅读全文
摘要:Count the stringTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2191Accepted Submission(s): 1038Problem DescriptionIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write dow
阅读全文
摘要:Information DisturbingTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 844Accepted Submission(s): 304Problem DescriptionIn the battlefield , an effective way to defeat enemies is to break their communication system.The information department told y
阅读全文
摘要:GeoDefenseTime Limit: 12000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 347Accepted Submission(s): 138Problem DescriptionTower defense is a kind of real-time strategy computer games. The goal of tower defense games is to try to stop enemies from reaching your b
阅读全文
摘要:Find Metal MineralTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1441Accepted Submission(s): 631Problem DescriptionHumans have discovered a kind of new metal mineral on Mars which are distributed in point‐like with paths connecting each of them wh
阅读全文
摘要:The more, The BetterTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3149Accepted Submission(s): 1857Problem DescriptionACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多
阅读全文
摘要:悼念512汶川大地震遇难同胞——珍惜现在,感恩生活Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7531Accepted Submission(s): 3108Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?后记:人生是
阅读全文
摘要:从放暑假前周sir给我讲了一个用polya计数法和burnside定理做的题目(pku2409)后,突然觉得组合数学挺有意思,然后从那时起到现在几乎都在做这类的题目。做到现在感觉这类题目的一些基本知识点都差不多有所了解了,水题也刷了不少,但还有很多难题自己实在是做不动,所以准备把这类题目先放一放,然后把前段时间做的水题整理一下(供以后的初学者参考,大牛就不要看了哈,都是水题)。剩下的比较难的题目就慢慢来吧,以后做出来再不上,这个小结会不断地更新。也希望大家有好的题目可以推荐一下,分享一下哈。感谢:周sir,J_factory和福州大学神牛aekdycoin,大连理工大学神牛czyuan。不扯了
阅读全文
摘要:Starship TroopersTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5726Accepted Submission(s): 1529Problem DescriptionYou, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge
阅读全文
摘要:ComputerTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1232Accepted Submission(s): 597Problem 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.
阅读全文
摘要:Anniversary partyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2124Accepted Submission(s): 896Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical struc
阅读全文
摘要:Clairewd’s messageTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1611Accepted Submission(s): 633Problem DescriptionClairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing f
阅读全文
摘要:Template Library ManagementTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 298Accepted Submission(s): 87Problem DescriptionAs an experienced ACMer, you must have known the importance of "code template library". With the help of pre-printe
阅读全文
摘要:Throw nailsTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 647Accepted Submission(s): 194Problem DescriptionThe annual school bicycle contest started. ZL is a student in this school. He is so boring because he can't ride a bike!! So he decided
阅读全文
摘要:LawrenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1248Accepted Submission(s): 557Problem DescriptionT. E. Lawrence was a controversial figure during World War I. He was a British officer who served in the Arabian theater and led a group of Ar
阅读全文
摘要:DivisionTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 999999/400000 K (Java/Others)Total Submission(s): 1672Accepted Submission(s): 630Problem DescriptionLittle D is really interested in the theorem of sets recently. There’s a problem that confused him a long time.Let T be a set of integers.
阅读全文
摘要:MAX Average ProblemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3521Accepted Submission(s): 896Problem DescriptionConsider a simple sequence which only contains positive integers as a1, a2 ... an, and a number k. Define ave(i,j) as the average v
阅读全文
摘要:Picnic CowsTime Limit: 8000/4000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1088Accepted Submission(s): 329Problem DescriptionIt’s summer vocation now. After tedious milking, cows are tired and wish to take a holiday. So Farmer Carolina considers having a picnic be
阅读全文
摘要:Print ArticleTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 2224Accepted Submission(s): 728Problem DescriptionZero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too
阅读全文
摘要:二分图匹配(匈牙利算法)1。一个二分图中的最大匹配数等于这个图中的最小点覆盖数König定理是一个二分图中很重要的定理,它的意思是,一个二分图中的最大匹配数等于这个图中的最小点覆盖数。如果你还不知道什么是最小点覆盖,我也在这里说一下:假如选了一个点就相当于覆盖了以它为端点的所有边,你需要选择最少的点来覆盖所有的边。2。最小路径覆盖=最小路径覆盖=|G|-最大匹配数在一个N*N的有向图中,路径覆盖就是在图中找一些路经,使之覆盖了图中的所有顶点,且任何一个顶点有且只有一条路径与之关联;(如果把这些路径中的每条路径从它的起始点走到它的终点,那么恰好可以经过图中的每个顶点一次且仅一次);如果
阅读全文
摘要:kiki's gameTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 40000/1000 K (Java/Others)Total Submission(s): 3786Accepted Submission(s): 2193Problem DescriptionRecently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the
阅读全文
摘要:Good Luck in CET-4 Everybody!Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2525Accepted Submission(s): 1585Problem Description大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。
阅读全文
摘要:完数Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11766Accepted Submission(s): 4082Problem Description完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3;28=1+2+4+7+14。本题的任务是判断两个正整数之间完数的个数。Input输入数据包含多行,第一行是一个正整数n,表示测试实例的个数,然后就是n个测试实例,每个实例占一
阅读全文
摘要:The time of a dayTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 742Accepted Submission(s): 327Problem DescriptionThere are no days and nights on byte island, so the residents here can hardly determine the length of a single day. Fortunately, they
阅读全文
摘要:Dwarven Sniper’s huntingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 441Accepted Submission(s): 199Problem DescriptionNow the hunting starts in the world named DOTA, a stupid PC game which cannot play with others together.Among the individuals i
阅读全文
摘要:GameTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 638Accepted Submission(s): 210Problem DescriptionAlice and Bob are playing game with each other. They play the game on a 2D board. Alice has many vertical 1*2 tiles while Bob has many horizontal 2
阅读全文
摘要:BombingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1377Accepted Submission(s): 533Problem DescriptionIt’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base.It seems not
阅读全文
摘要:24 PuzzleTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1012Accepted Submission(s): 304Problem DescriptionDaniel likes to play a special board game, called 24 puzzle. 24 puzzle is such a game that there are tiles with the number 1 to 23 in a play
阅读全文
摘要:Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4258Accepted Submission(s): 2285Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出
阅读全文
摘要:Round NumbersTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 6051Accepted: 2050DescriptionThe 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 name
阅读全文
摘要:Wine Trading in GergoviaTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2765Accepted: 1245DescriptionAs you may know from the comic “Asterix and the Chieftain’s Shield”, Gergovia consists of one street, and every inhabitant of the city is a wine salesman. You wonder how this economy works?
阅读全文
摘要:Minimum CostTime Limit: 4000MSMemory Limit: 65536KTotal Submissions: 10978Accepted: 3692DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (ma
阅读全文
摘要:Going HomeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13994Accepted: 7167DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to p
阅读全文
摘要:A Plug for UNIXTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 11636Accepted: 3834DescriptionYou are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and
阅读全文
摘要:DiningTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 6586Accepted: 3015DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he forgot to check his menu against
阅读全文
摘要:ACM Computer FactoryTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4077Accepted: 1366Special JudgeDescriptionAs you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the
阅读全文
摘要:Power NetworkTime Limit: 2000MSMemory Limit: 32768KTotal Submissions: 18309Accepted: 9643DescriptionA 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
阅读全文
摘要:Treasure ExplorationTime Limit: 6000MSMemory Limit: 65536KTotal Submissions: 5480Accepted: 2154DescriptionHave you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you would neve
阅读全文
摘要:Guardian of DecencyTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 4071Accepted: 1702DescriptionFrank N. Stein is a very conservative high-sc...
阅读全文
摘要:Going HomeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13981Accepted: 7156DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to p
阅读全文
摘要:Air RaidTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1904Accepted Submission(s): 1225Problem DescriptionConsider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from
阅读全文
摘要:Machine ScheduleTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3444Accepted Submission(s): 1669Problem DescriptionAs we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Sche
阅读全文
摘要:Strategic GameTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2925Accepted Submission(s): 1222Problem DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is v
阅读全文
摘要:Strategic GameTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2916Accepted Submission(s): 1217Problem DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is v
阅读全文
摘要:二分图如果是没有权值的,求最大匹配。则是用匈牙利算法求最大匹配。如果带了权值,求最大或者最小权匹配,则必须用KM算法。 其实最大和最小权匹配都是一样的问题。只要会求最大匹配,如果要求最小权匹配,则将权值取相反数,再把结果取相反数,那么最小权匹配就求出来了。 KM算法及其难理解。。。看了几天还无头绪。 先拿上一直采用的KM算法模板,按照吉林大学的模板写的。试试了好多次感觉都没有出错。/******************************************************二分图最佳匹配 (kuhn munkras 算法 O(m*m*n)).邻接矩阵形式 。 返回最佳匹配值..
阅读全文
摘要:TramTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 7180Accepted: 2601DescriptionTram network in Zagreb consists of a number of intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the intersection. When the t
阅读全文
摘要:Prime TestTime Limit: 6000MSMemory Limit: 65536KTotal Submissions: 24514Accepted: 5730Case Time Limit: 4000MSDescriptionGiven a big integer number, you are required to find out whether it's a prime number.InputThe first line contains the number of test cases T (1 <= T <= 20 ), then the fol
阅读全文
摘要:传说中的随机算法。效率极高。可以对一个2^63的素数进行判断。可以分解比较大的数的因子。#include<stdio.h>#include<string.h>#include<stdlib.h>#include<time.h>#include<iostream>#include<algorithm>using namespace std;//****************************************************************// Miller_Rabin 算法进行素数测试//速度
阅读全文
摘要:KindergartenTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 3866Accepted: 1832DescriptionIn a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also know each other. In addition to that, some girls and boys know each other. Now the teachers want to pi
阅读全文
摘要:The Perfect StallTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 14447Accepted: 6612DescriptionFarmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the new barn are different. For th
阅读全文
摘要:Antenna PlacementTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4739Accepted: 2359DescriptionThe Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of a
阅读全文
摘要:AsteroidsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10288Accepted: 5556DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are convenientl
阅读全文
摘要:Invitation CardsTime Limit: 8000MSMemory Limit: 262144KTotal Submissions: 14556Accepted: 4710DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. T
阅读全文
摘要:CodeTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 6093Accepted: 2865DescriptionTransmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequ
阅读全文
摘要:ArbitrageTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 11008Accepted: 4629DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British po
阅读全文
摘要:Stockbroker GrapevineTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 21124Accepted: 11474DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in th
阅读全文
摘要:FroggerTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 17842Accepted: 5818DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunsc
阅读全文
摘要://大数乘小数void mult(char c[],int m,char t[]){ char s[100]; int len=strlen(c); for(int i=0;i<len;i++) s[len-i-1]=c[i]-'0'; int flag,add=0; for(int i=0;i<len;i++) { int k=s[i]*m+add; if(k>=10) { s[i]=k%10; add=k/10; flag=1; ...
阅读全文
摘要:昂贵的聘礼Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 27365Accepted: 7639Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东
阅读全文
摘要:WormholesTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 20639Accepted: 7342DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BE
阅读全文
摘要:/*POJ 1860有多种汇币,汇币之间可以交换,这需要手续费,当你用100A币交换B币时,A到B的汇率是29.75,手续费是0.39,那么你可以得到(100 - 0.39) * 29.75 = 2963.3975 B币。问s币的金额经过交换最终得到的s币金额数能否增加货币的交换是可以重复多次的,所以我们需要找出是否存在正权回路,且最后得到的s金额是增加的怎么找正权回路呢?(正权回路:在这一回路上,顶点的权值能不断增加即能一直进行松弛)关键在于反向利用Bellman-Ford算法单源最短路径算法,因为题目可能存在负边,所以用Bellman Ford算法,原始Bellman Ford可以用来求负
阅读全文
摘要:CandiesTime Limit: 1500MSMemory Limit: 131072KTotal Submissions: 18737Accepted: 4930DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the kids
阅读全文
摘要:LayoutTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4641Accepted: 2240DescriptionLike everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are standing
阅读全文
摘要:0 or 1Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 692Accepted Submission(s): 185Problem DescriptionGiven a n*n matrix Cij (1<=i,j<=n),We want to find a n*n matrix Xij (1<=i,j<=n),which is 0 or 1.Besides,Xij meets the following condi
阅读全文
摘要:好像目前还没有这方面题目的总结。这几天连续看到四个问这类题目的人,今天在这里简单写一下。这里我们不介绍其它有关矩阵的知识,只介绍矩阵乘法和相关性质。不要以为数学中的矩阵也是黑色屏幕上不断变化的绿色字符。在数学中,一个矩阵说穿了就是一个二维数组。一个n行m列的矩阵可以乘以一个m行p列的矩阵,得到的结果是一个n行p列的矩阵,其中的第i行第j列位置上的数等于前一个矩阵第i行上的m个数与后一个矩阵第j列上的m个数对应相乘后所有m个乘积的和。比如,下面的算式表示一个2行2列的矩阵乘以2行3列的矩阵,其结果是一个2行3列的矩阵。其中,结果的那个4等于2*2+0*1: 下面的算式则是一个1 x 3的矩阵乘以
阅读全文
摘要:Developing School's Contest 6 说明:此报告只是个人的总结,非官方报告。此中有些想法也是自己一孔之见,有不对的地方,望不吝赐教! 尚未完成,还在更新中··········kuangbinB.寻找最大值Time Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 36Accepted Submission(s) : 9Font:
阅读全文
摘要:Minimum SumTime Limit: 16000/8000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1533Accepted Submission(s): 345Problem DescriptionYou are given N positive integers, denoted as x0, x1 ... xN-1. Then give you some intervals [l, r]. For each interval, you need to find a
阅读全文
摘要:AtlantisTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3469Accepted Submission(s): 1549Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts
阅读全文
摘要:覆盖的面积Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2304Accepted Submission(s): 1136Problem Description给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代
阅读全文
摘要:Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2396Accepted Submission(s): 886Problem DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally
阅读全文
摘要:InvestmentTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 5362Accepted: 1843DescriptionJohn never knew he had a grand-uncle, until he received the notary's letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only in
阅读全文
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9258Accepted Submission(s): 4510Problem 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
阅读全文
摘要:Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4647Accepted Submission(s): 2809Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai
阅读全文
摘要:The Famous ICPC Team AgainTime Limit: 30000/15000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 438Accepted Submission(s): 193Problem DescriptionWhen Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Contest, Mr. B had collected a large set of co
阅读全文
摘要:Kth numberTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2026Accepted Submission(s): 672Problem DescriptionGive you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases. For each test case, th
阅读全文
摘要:假设主串:S: S[1] S[2] S[3] ……S[n]模式串:T: T[1] T[2] T[3]…..T[m]现在我们假设主串第i 个字符与模式串的第j(j<=m)个字符‘失配’后,主串第i 个字符与模式串的第k(k<j)个字符继续比较,此时就有S[i] != T[j]主串: S[1]...S[i-j+1]...S[i-1]S[i]... ||(匹配) || ≠模式串: T[1]... T[j-1] T[j]由此,可以得到关系式如下 T[1]T[2]T[3]...T[j-1] = S[i-j+1]...S[i-1]由于S[i] != T[j],接下来S[i]将与T[k]继续比较
阅读全文
摘要:Collect More JewelsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2932Accepted Submission(s): 547Problem DescriptionIt is written in the Book of The Lady: After the Creation, the cruel god Moloch rebelled against the authority of Marduk the Creato
阅读全文
摘要:TautologyTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6088Accepted: 2315DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any string of these s
阅读全文
摘要:Emag eht htiw Em PlehTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1950Accepted: 1315DescriptionThis problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.Inputaccording to output of problem 2996.Outputacc
阅读全文
摘要:Help Me with the GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2426Accepted: 1571DescriptionYour task is to read a picture of a chessboard position and print it in the chess notation.InputThe input consists of an ASCII-art picture of a chessboard with chess pieces on positions describ
阅读全文
摘要:Robot MotionTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 7892Accepted: 3812DescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page)
阅读全文
摘要:Crashing RobotsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5453Accepted: 2382DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouse
阅读全文
摘要:ParencodingsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 15075Accepted: 8989DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith rig
阅读全文
摘要:Integer InquiryTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6755Accepted Submission(s): 1723Problem DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333
阅读全文
摘要:EightTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 18387Accepted: 8182Special JudgeDescriptionThe 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, a
阅读全文
摘要:HDU 1043 和 POJ 1077 两题类似。。。但是输入不同。HDU 上是同时多组输入,POJ是单组输入。两个限时不同。HDU 上反向搜索,把所有情况打表出来。POJ上正向搜索。这个题很经典,还需要继续做。先把第一次写的代码贴出来吧。继续优化中HDU 1043EightTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7145Accepted Submission(s): 1946Special JudgeProblem Descript
阅读全文
摘要:Computer TransformationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3845Accepted Submission(s): 1420Problem DescriptionA sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the compu
阅读全文
摘要:加、减、乘、除高精度 string kuangbin#include<stdio.h>#include<string>#include<string.h>#include<iostream>using namespace std;//compare比较函数:相等返回0,大于返回1,小于返回-1int compare(string str1,string str2){ if(str1.length()>str2.length()) return 1; else if(str1.length()<str2.length()) return
阅读全文
摘要:Ball bearingsTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 40Accepted Submission(s): 20Problem DescriptionThe Swedish company SKF makes ball bearings. As explained by Britannica Online, a ball bearing is “one of the two types of rolling, or anti
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18473Accepted Submission(s): 8034Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数
阅读全文
摘要:Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 4570Accepted Submission(s): 1087Problem DescriptionA lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to
阅读全文
摘要:FactorialTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1699Accepted Submission(s): 1085Problem DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this t
阅读全文
摘要:A/BTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 639Accepted Submission(s): 517Problem 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
阅读全文
摘要:Balanced LineupTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 23699Accepted: 11019Case 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
阅读全文
摘要:Count the ColorsTime Limit: 2 Seconds Memory Limit: 65536 KBPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.InputThe first line of each data set contains .
阅读全文
摘要:SumdivTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10071Accepted: 2357DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natural numbers A an
阅读全文
摘要:JapanTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 14795Accepted: 3968DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000
阅读全文
摘要:CowsTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 8497Accepted: 2777DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good. Farmer John has N cows (we
阅读全文
摘要:Mobile phonesTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 11018Accepted: 5044DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbe
阅读全文
摘要:StarsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 22464Accepted: 9787DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to t
阅读全文
摘要:Ultra-QuickSortTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 27665Accepted: 9915DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted
阅读全文
摘要:Gold minerTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 454Accepted Submission(s): 226Problem DescriptionHomelesser likes playing Gold miners in class. He has to pay much attention to the teacher to avoid being noticed. So he always lose the game
阅读全文
摘要:PermutationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 291Accepted Submission(s): 168Problem DescriptionThere is an arrangement of N numbers and a permutation relation that alter one arrangement into another.For example, when N equals to 6 the
阅读全文
摘要:Xiao Ming's HopeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 433Accepted Submission(s): 290Problem DescriptionXiao Ming likes counting numbers very much, especially he is fond of counting odd numbers. Maybe he thinks it is the best way to sh
阅读全文
摘要:History repeat itselfTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 460Accepted Submission(s): 223Problem DescriptionTom took the Discrete Mathematics course in the 2011,but his bad attendance angered Professor Lee who is in charge of the course.
阅读全文
摘要:Resource ArchiverTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 899Accepted Submission(s): 238Problem DescriptionGreat! Your new software is almost finished! The only thing left to do is archiving all your n resource files into a big one.Wait
阅读全文
摘要:Wireless PasswordTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2189Accepted Submission(s): 610Problem DescriptionLiyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know th
阅读全文
摘要:Keywords SearchTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18800Accepted Submission(s): 6269Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to
阅读全文
摘要:Colored SticksTime Limit: 5000MSMemory Limit: 128000KTotal Submissions: 24748Accepted: 6519DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch
阅读全文
摘要:Power StringsTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 23112Accepted: 9691DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplica
阅读全文
摘要:PeriodTime Limit: 3000MSMemory Limit: 30000KTotal Submissions: 9696Accepted: 4428DescriptionFor each prefix of a given string S with N characters (eac...
阅读全文
摘要:Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5898Accepted Submission(s): 2652Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 100
阅读全文
摘要:OulipoTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12818Accepted: 5128DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s’a
阅读全文
摘要:IMMEDIATE DECODABILITYTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 8895Accepted: 4222DescriptionAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes are in
阅读全文
摘要:Hat’s WordsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3565Accepted Submission(s): 1355Problem 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
阅读全文
摘要:Phone ListTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 16341Accepted: 5228DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911Alice 97 625 999Bob
阅读全文
摘要:统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 10295Accepted Submission(s): 4216Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统
阅读全文
摘要:Doing Homework againTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2969Accepted Submission(s): 1707Problem 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
阅读全文
摘要:The number of divisors(约数) about Humble NumbersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1623Accepted Submission(s): 789Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5,
阅读全文
摘要:排列2Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2554Accepted Submission(s): 991Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0<=数字<=9),如果四张卡片都是0,则输入结束。Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成
阅读全文
摘要:Buy SticksTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 652Accepted Submission(s): 280Problem DescriptionImyourgod need 3 kinds of sticks which have different sizes: 20cm, 28cm and 32cm. However the shop only sell 75-centimeter-long sticks. So he
阅读全文
摘要:Is It A Tree?Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6961Accepted Submission(s): 1619Problem DescriptionA 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
阅读全文
摘要:最少拦截系统Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9039Accepted Submission(s): 3514Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套
阅读全文