11 2011 档案
摘要:Diplomatic LicenseTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2289 Accepted: 1105DescriptionIn an effort to minimize the expenses for foreign affairs the countries of the world have argued as follows. It is not enough that each country maintains diplomatic relations with at most one ot
阅读全文
摘要:Programmer, Rank ThyselfTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 901 Accepted: 366DescriptionImplement a ranking program similar to the one used for this programming contest.InputThe input file contains one or more contests followed by a line containing only zero that signals the en
阅读全文
摘要:字符串替换Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6311Accepted: 2943Description编写一个C程序实现将字符串中的所有"you"替换成"we"Input输入包含多行数据 每行数据是一个字符串,长度不超过1000 数据以EOF结束Output对于输入的每一行,输出替换后的字符串Sample Inputyou are what you doSample Outputwe are what we do#include<stdio.h>#include&
阅读全文
摘要:序列Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5036Accepted: 2217Description数列A满足An = An-1 + An-2 + An-3, n >= 3 编写程序,给定A0, A1 和 A2, 计算A99Input输入包含多行数据 每行数据包含3个整数A0, A1, A2 (0 <= A0, A1, A2 <= 32767) 数据以EOF结束Output对于输入的每一行输出A99的值Sample Input1 1 1Sample Output69087442470169316923
阅读全文
摘要:分数加减法Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8801Accepted: 2798Description编写一个C程序,实现两个分数的加减法Input输入包含多行数据 每行数据是一个字符串,格式是"a/boc/d"。 其中a, b, c, d是一个0-9的整数。o是运算符"+"或者"-"。 数据以EOF结束 输入数据保证合法Output对于输入数据的每一行输出两个分数的运算结果。 注意结果应符合书写习惯,没有多余的符号、分子、分母,并且化简至最简分数Samp
阅读全文
摘要:取模运算Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6776Accepted: 4182Description编写一个C函数mod(int n, int m),实现取模运算%Input输入包含多行数据 每行数据是两个整数a, b (1 <= a, b <= 32767) 数据以EOF结束Output于输入的每一行输出a%bSample Input5 3100 2Sample Output20#include<stdio.h>int mod(int n, int m){ if(n<m) retur
阅读全文
摘要:String LDTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 488Accepted: 262DescriptionStringld (left delete) is a function that gets a string and deletes its leftmost character (for instance Stringld(“acm”) returns “cm”). You are given a list of distinct words, and at each step, we apply stri
阅读全文
摘要:小孩报数问题Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6459Accepted: 3024Description有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N<=64) 接下来每行输入一个小孩的名字(人名不超过15个字符) 最后一行输入W,S (W < N),用逗号","间隔Outp
阅读全文
摘要:时间日期格式转换Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5562Accepted: 2569Description世界各地有多种格式来表示日期和时间。对于日期的常用格式,在中国常采用格式的是“年年年年/月月/日日”或写为英语缩略表示的”yyyy/mm/dd”,此次编程大赛的启动日期“2009/11/07”就是符合这种格式的一个日期,而北美所用的日期格式则为“月月/日日/年年年年”或”mm/dd/yyyy”,如将“2009/11/07”改成这种格式,对应的则是”11/07/2009”。对于时间的格式,则常有12小时制和24
阅读全文
摘要:位操作Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7076Accepted: 2769Description假设你工作在一个32位的机器上,你需要将某一个外设寄存器的第X位设置成0(最低位为第0位,最高位为第31位),将第Y位开始的连续三位设置成110(从高位到低位的顺序),而其他位保持不变。对给定的寄存器值R,及X,Y,编程计算更改后的寄存器值R。Input仅一行,包括R,X,Y,以逗号","分隔,R为16进制表示的32位整数,X,Y在0-31之间且Y>=3,(Y-X)的绝对值>=3,保证两
阅读全文
摘要:破译密码Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5834Accepted: 3596Description据说最早的密码来自于罗马的凯撒大帝。消息加密的办法是:对消息原文中的每个字母,分别用该字母之后的第5个字母替换(例如:消息原文中的每个字母A都分别替换成字母F)。而你要获得消息原文,也就是要将这个过程反过来。 密码字母:A B C D E F G H I J K L M N O P Q R S T U V W X Y Z M 原文字母:V W X Y Z A B C D E F G H I J K L M N O P
阅读全文
摘要:Panda's Birthday PresentTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1200Accepted: 796DescriptionOn Panda's Birthday party, he received a strange present from Jason. The present is a black box with 4 dices in it which is used to play a game. The dice in the box is unusual. Instea
阅读全文
摘要:Long Distance RacingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5783Accepted: 3081DescriptionBessie is training for her next race by running on a path that includes hills so that she will be prepared for any terrain. She has planned a straight path and wants to run as far as she can --
阅读全文
摘要:Cow MultiplicationTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9215Accepted: 6185DescriptionBessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style, A*B is equal to the sum of all possible pairwise products between the
阅读全文
摘要:Costume PartyTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8495Accepted: 3279DescriptionIt's Halloween! Farmer John is taking the cows to a costume party, but unfortunately he only has one costume. The costume fits precisely two cows with a length of S (1 ≤ S ≤ 1,000,000). FJ has N co
阅读全文
摘要:Election TimeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5030Accepted: 2750DescriptionThe cows are having their first election after overthrowing the tyrannical Farmer John, and Bessie is one of N cows (1 ≤ N ≤ 50,000) running for President. Before the election actually happens, however
阅读全文
摘要:The Dragon of LoowaterTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2266Accepted: 1173DescriptionOnce upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due
阅读全文
摘要:The Seven Percent SolutionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6130Accepted: 4066DescriptionUniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:foo@bar.org, ftp://127.0.0.1/pub/linux, or even just readme.txt that are used to identify a res
阅读全文
摘要:Optimal ParkingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6436Accepted: 3650DescriptionWhen shopping on Long Street, Michael usually parks his car at some random location, and then walks to the stores he needs. Can you help Michael choose a place to park which minimises the distance he
阅读全文
摘要:ShopaholicTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4217Accepted: 2443DescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to buy all items in the store. You have given
阅读全文
摘要:Phone ListTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13726Accepted: 4408DescriptionGiven 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
阅读全文
摘要:Charm BraceletTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10693Accepted: 4830DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm
阅读全文
摘要:BookshelfTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5281Accepted: 2620DescriptionFarmer John recently bought a bookshelf for cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.Each of the N cows (1 ≤ N ≤ 20,000) has some height
阅读全文
摘要:iChessTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2225Accepted: 979DescriptionThe Jury of NEERC’07 quarterfinals is proud to present you a new game — chess patience. This patience is played not with cards, but with black and white square tiles. The goal of the game is to place these til
阅读全文
摘要:Number-guessing GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5279Accepted: 3858DescriptionLarry likes playing the number-guessing game.Two players are needed in a game. Suppose they are X and Y, and X presents a number for Y to guess. Firstly, X chooses a number with four different d
阅读全文
摘要:Beer RefrigeratorTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3351Accepted: 1308Special JudgeDescriptionBeer Lovers Club makes regular parties. They hate warm beer, but club’s refrigerator is too small to store enough beer for the whole company. So they decided to order a special super-b
阅读全文
摘要:Prime GapTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 6120Accepted: 3480DescriptionThe 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
阅读全文
摘要:Judging OlympiaTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5900Accepted: 2831DescriptionFor years, a group of Regional Contest Directors (RCDs) of the ACM International Collegiate Programming Contest (ICPC) have been unsatisfied with the way contest submissions get ranked. The group see
阅读全文
摘要:Wavelet CompressionTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 1942Accepted: 1268DescriptionThe discrete wavelet transform is a popular tool for signal compression. In this problem, your job is to write a program to decompress a one-dimensional signal (a list of integers) that has been
阅读全文
摘要:Tower ParkingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1210Accepted: 758DescriptionThere is a new revolution in the parking lot business: the parking tower. The concept is simple: you drive your car into the elevator at the entrance of the tower, and the elevator and conveyor belts dr
阅读全文
摘要:Halloween HolidaysTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2736Accepted: 1095DescriptionPlanet Cucurbita is inhabited with intelligent pumpkins. These pumpkins are not only extremely clever, they also are fond of tourism. One of their main routes is the Earth during Halloween.As you
阅读全文
摘要:Look and SayTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 7551Accepted: 4557DescriptionThe look and say sequence is defined as follows. Start with any string of digits as the first element in the sequence. Each subsequent element is defined from the previous one by "verbally" de
阅读全文
摘要:Candy DistributionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4814Accepted: 2595DescriptionN children standing in circle who are numbered 1 through N clockwise are waiting their candies. Their teacher distributes the candies by in the following way:First the teacher gives child No.1 and
阅读全文
摘要:Black and white paintingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2326Accepted: 1574DescriptionYou are visiting the Centre Pompidou which contains a lot of modern paintings. In particular you notice one painting which consists solely of black and white squares, arranged in rows and co
阅读全文
摘要:Deli DeliTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3485Accepted: 1954DescriptionMrs. Deli is running the delicatessen store "Deli Deli". Last year Mrs. Deli has decided to expand her business and build up an online store. She has hired a programmer who has implemented the on
阅读全文
摘要:SubsequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6865Accepted: 3998DescriptionGiven a string s of length n, a subsequence of it, is defined as another string s' = su1su2...sum where 1 ≤ u1 < u2 < ... < um ≤ n and si is the ith character of s. Your task is to write a p
阅读全文
摘要:ICPC Score Totalizer SoftwareTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 5955Accepted: 4130DescriptionThe International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of th
阅读全文
摘要:Tour de FranceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3661Accepted: 1734DescriptionA racing bicycle is driven by a chain connecting two sprockets. Sprockets are grouped into two clusters: the front cluster (typically consisting of 2 or 3 sprockets) and the rear cluster (typically co
阅读全文
摘要:Go for Lab Cup!Time Limit: 1000MSMemory Limit: 131072KTotal Submissions: 7595Accepted: 3887DescriptionThe Lab Cup Table Tennis Competition is going to take place soon among laboratories in PKU. Students from the AI Lab are all extreme enthusiasts in table tennis and hold strong will to represent the
阅读全文
摘要:HumidexTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9883Accepted: 3755DescriptionAdapted from Wikipedia, the free encyclopediaThe humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index used in the Unite
阅读全文
摘要:CoinsTime Limit: 1000MSMemory Limit: 131072KTotal Submissions: 5958Accepted: 3856DescriptionSnoopy has three coins. One day he tossed them on a table then and tried to flip some of them so that they had either all heads or all tails facing up. After several attempts, he found that regardless of the
阅读全文
摘要:Cow BowlingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9426Accepted: 6216DescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: 7 3 8...
阅读全文
摘要:Uncle JackTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3744Accepted: 1565DescriptionDear Uncle Jack is willing to give away some of his collectable CDs to his nephews. Among the titles you can find very rare albums of Hard Rock, Classical Music, Reggae and much more; each title is consid
阅读全文
摘要:Parkside's TriangleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6482Accepted: 3918DescriptionBessie taught the cows to make Parkside's Triangle. It is generated from two numbers: the size and the seed. The size N (1 <= N <= 20) determines how many rows are in the triangle a
阅读全文
摘要:#include<iostream>using namespace std;int main(){ char temp[15]; int score; int t,n; int sum; int draw; while(1) { cin>>t; cin>>n; if(t==0) break; sum=0; while(t--) { cin>>temp; cin>>score; sum...
阅读全文
摘要:Java vs C++Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 6109Accepted: 1675DescriptionApologists of Java and C++ can argue for hours proving each other that their programming language is the best one. Java people will tell that their programs are clearer and less prone to errors, while C+
阅读全文
摘要:Surprising StringsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3839Accepted: 2582DescriptionThe D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs are different. A string is surprising if it is D
阅读全文
摘要:Root of the ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9940Accepted: 5297DescriptionGiven positive integers B and N, find an integer A such that AN is as close as possible to B. (The result A is an approximation to the Nth root of B.) Note that AN may be less than, equal to, or
阅读全文
摘要:QuicksumTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9911Accepted: 6842DescriptionA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transm
阅读全文
摘要:Quick ChangeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4756Accepted: 3491DescriptionJ.P. Flathead’s Grocery Store hires cheap labor to man the checkout stations. The people he hires (usually high school kids) often make mistakes making change for the customers. Flathead, who’s a bit of
阅读全文
摘要:Triangular SumsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5361Accepted: 3788DescriptionThe nth Triangular number, T(n) = 1 + … + n, is the sum of the first n integers. It is the number of points in a triangular array with n points on side. For example T(4):XX XX X XX X X XWrite a progr
阅读全文
摘要:RoundersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6316Accepted: 4081DescriptionFor a given number, if greater than ten, round it to the nearest ten, then (if that result is greater than 100) take the result and round it to the nearest hundred, then (if that result is greater than 1000
阅读全文
摘要:Celebrity jeopardyTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 11429Accepted: 6421DescriptionIt's hard to construct a problem that's so easy that everyone will get it, yet still difficult enough to be worthy of some respect. Usually, we err on one side or the other. How simple ca
阅读全文
摘要:Card TrickTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2838Accepted: 2092DescriptionThe magician shuffles a small pack of cards, holds it face down and performs the following procedure:The top card is moved to the bottom of the pack. The new top card is dealt face up onto the table. It i
阅读全文
摘要:Dirichlet's Theorem on Arithmetic ProgressionsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10814Accepted: 5388DescriptionIf a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, ..., conta
阅读全文
摘要:Nasty HacksTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9031Accepted: 6352DescriptionYou are the CEO of Nasty Hacks Inc., a company that creates small pieces of malicious software which teenagers may use to fool their friends. The company has just finished their first product and it is t
阅读全文
摘要:DivisorsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7846Accepted: 2163DescriptionYour task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful computation?InputThe input consists of several instances. Each in
阅读全文
摘要:Ball bearingsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2766Accepted: 1592DescriptionThe Swedish company SKF makes ball bearings. As explained by Britannica Online, a ball bearing is "one of the two types of rolling, or anti friction, bearings (the other is the roller bearing). It
阅读全文
摘要:ScrabbleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1634Accepted: 929DescriptionThe game of Scrabble is played with tiles. A tile either has a single letter written on it, or it is blank. In the latter case, the tile may be used to represent a letter of your choice. On your turn, you ar
阅读全文
摘要:Homogeneous SquaresTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 3344Accepted: 1808DescriptionAssume you have a square of size n that is divided into n × n positions just as a checkerboard. Two positions (x1, y1) and (x2, y2), where 1 ≤ x1, y1, x2, y2 ≤ n, are called “independent” if
阅读全文
摘要:Gauß in Elementary SchoolTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7610Accepted: 3440DescriptionJohann Carl Friedrich Gauß (1777 – 1855) was one of the most important German mathematicians. For those of you who remember the Deutsche Mark, a picture of him was printed on the
阅读全文
摘要:Goldbach's ConjectureTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8274Accepted: 4779DescriptionFor any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such thatn = p1 + p2This conjecture has not been proved nor refused yet. No one i
阅读全文
摘要:Ancient KeyboardTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2785Accepted: 1541DescriptionThe scientists have found an ancient device that works in a strange way. The device has a keyboard and an output tape. The keyboard has 26 keys, with symbols 'A' through 'Z' on them.
阅读全文
摘要:Best SMS to TypeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3631Accepted: 1518DescriptionUsing SMS today is more than a pleasing hobby. As the number of messages one sends through this service grows, the need to type them fast is better felt. Sometimes, one wonders how fast a message ca
阅读全文
摘要:Cantoring AlongTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3105Accepted: 1704DescriptionThe Cantor set was discovered by Georg Cantor. It is one of the simpler fractals. It is the result of an infinite process, so for this program, printing an approximation of the whole set is enough. T
阅读全文
摘要:A Simple Question of ChemistryTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5583Accepted: 3707DescriptionYour chemistry lab instructor is a very enthusiastic graduate student who clearly has forgotten what their undergraduate Chemistry 101 lab experience was like. Your instructor has come
阅读全文
摘要:Pascal LibraryTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3291Accepted: 1615DescriptionPascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building started to show the effects of supporting the weight of the
阅读全文
摘要:Sequence Sum PossibilitiesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4864Accepted: 3230DescriptionMost positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance,6 = 1 + 2 + 39 = 5 + 4 = 2 + 3 + 4but 8cannot be so written.Write a
阅读全文
摘要:Big ClockTime Limit: 1000MSMemory Limit: 131072KTotal Submissions: 7826Accepted: 4964DescriptionOur vicar raised money to have the church clock repaired for several weeks. The big clock, which used to strike the hours days and nights, was damaged several weeks ago and had been silent since then. Aft
阅读全文
摘要:01000001Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8615Accepted: 2786DescriptionAdding binary numbers is a very simple task, and very similar to the longhand addition of decimal numbers. As with decimal numbers, you start by adding the bits (digits) one column at a time, from right to
阅读全文
摘要:Making ChangeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1220Accepted: 671DescriptionGrocery stores have long struggled with how to avoid long checkout lines that leave customers frustrated. The "10 item or less" express line has been a common technique, but many stores a now
阅读全文
摘要:LinearityTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 6722Accepted: 1499DescriptionAlice often examines star maps where stars are represented by points in a plane and there is a Cartesian coordinate for each star. Let the Linearity of a star map be the maximum number of stars in a straig
阅读全文
摘要:4 Values whose Sum is 0Time Limit: 15000MSMemory Limit: 228000KTotal Submissions: 10535Accepted: 2904Case Time Limit: 5000MSDescriptionThe SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that
阅读全文
摘要:Reduced ID NumbersTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7346Accepted: 2971DescriptionT. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0 ≤ s ≤ MaxSIN with MaxSIN = 106-1.
阅读全文
摘要:Sum of Consecutive Prime NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12236Accepted: 6850DescriptionSome 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
阅读全文
摘要:Holiday HotelTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7220Accepted: 2827DescriptionMr. and Mrs. Smith are going to the seaside for their holiday. Before they start off, they need to choose a hotel. They got a list of hotels from the Internet, and want to choose some candidate hotels
阅读全文
摘要:Faulty OdometerTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8073Accepted: 4983DescriptionYou are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from the digit 3 to the digit 5, always skipping over the digit 4. This d
阅读全文
摘要:Copier ReductionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7516Accepted: 3876DescriptionWhat do you do if you need to copy a 560x400mm image onto a standard sheet of US letter-size paper (which is about 216x280mm), while keeping the image as large as possible? You can rotate the image
阅读全文
摘要:Paint MixTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 1462Accepted: 461DescriptionYou are given two large pails. One of them (known as the black pail) contains B gallons of black paint. The other one (known as the white pail) contains W gallons of white paint. You will go through a numbe
阅读全文
摘要:A Mysterious FunctionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3517Accepted: 2398DescriptionFor any integers p and q with q > 0, define p mod q to be the integer r with 0 <= r <= q −1 such that p−r is divisible by q. For example, we have 109 mod 10 = 9−7 mod 3 = 2−56 mod 7 =
阅读全文
摘要:Numeral SystemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1887Accepted: 1458DescriptionProf. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3&
阅读全文
摘要:Anagrammatic DistanceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3754Accepted: 2118DescriptionTwo words are said to be anagrams of each other if the letters from one word can be rearranged to form the other word. For example, occurs is an anagram of succor; however, dear is not an anagr
阅读全文
摘要:TreesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8104Accepted: 5385DescriptionThe road off the east gate of Peking University used to be decorated with a lot of trees. However, because of the construction of a subway, a lot of them are cut down or moved away. Now please help to count ho
阅读全文
摘要:Tri TilingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5805Accepted: 3099DescriptionIn how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. InputInput consists of several test cases followed by a line containing -1. Each test case is
阅读全文
摘要:Prerequisites?Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 3005Accepted: 1896DescriptionFreddie the frosh has chosen to take k courses. To meet the degree requirements, he must take courses from each of several categories. Can you assure Freddie that he will graduate, based on his course
阅读全文
摘要:Rock-Paper-Scissors TournamentTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 1891Accepted: 751DescriptionRock-Paper-Scissors is game for two players, A and B, who each choose, independently of the other, one of rock, paper, or scissors. A player chosing paper wins over a player chosing roc
阅读全文
摘要:Unhappy JinjinTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8861Accepted: 6528DescriptionJinjin is a junior school student. Besides the classes in school, Jinjin's mother also arranges some supplementary classes for her. However, if Jinjin studies for more than eight hours a day, she
阅读全文
摘要:ElectionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3248Accepted: 1552DescriptionCanada has a multi-party system of government. Each candidate is generally associated with a party, and the party whose candidates win the most ridings generally forms the government. Some candidates run as
阅读全文
摘要:BilliardTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1160Accepted: 736DescriptionIn a billiard table with horizontal side a inches and vertical side b inches, a ball is launched from the middle of the table. After s > 0 seconds the ball returns to the point from which it was launched,
阅读全文
摘要:Electrical OutletsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6964Accepted: 5316DescriptionRoy has just moved into a new apartment. Well, actually the apartment itself is not very new, even dating back to the days before people had electricity in their houses. Because of this, Roy's
阅读全文
摘要:Sequence MedianTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12242Accepted: 3521DescriptionGiven a sequence of N nonnegative integers. Let's define the median of such sequence. If N is odd the median is the element with stands in the middle of the sequence after it is sorted. One may
阅读全文
摘要:Common permutationTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5059Accepted: 1519DescriptionGiven two strings of lowercase letters, a and b, print the longest string x of lowercase letters such that there is a permutation of x that is a subsequence of a and there is a permutation of x th
阅读全文
摘要:Mine SweeperTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5569Accepted: 2180DescriptionThe game Minesweeper is played on an n by n grid. In this grid are hidden m mines, each at a distinct grid location. The player repeatedly touches grid positions. If a position with a mine is touched, t
阅读全文
摘要:Rabbit huntTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6017Accepted: 2943DescriptionA good hunter kills two rabbits with one shot. Of course, it can be easily done since for any two points we can always draw a line containing the both. But killing three or more rabbits in one shot is mu
阅读全文
摘要:SoundexTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8097Accepted: 3990DescriptionSoundex coding groups together words that appear to sound alike based on their spelling. For example, "can" and "khawn", "con" and "gone" would be equivalent under Sou
阅读全文
摘要:Superlong sumsTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 20143Accepted: 5835DescriptionThe creators of a new programming language D++ have found out that whatever limit for SuperLongInt type they make, sometimes programmers need to operate even larger numbers. A limit of 1000 digits is
阅读全文
摘要:Simple game on a gridTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 847Accepted: 435DescriptionThere is an infinite grid and an m*n rectangle of stones on it (1 <= m,n <= 1000). The stones are located in the knots of the grid. A following game for a single player is being played. One
阅读全文
摘要:Simple calculationsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5803Accepted: 2947DescriptionThere is a sequence of n+2 elements a0, a1, ..., an+1 (n<=3000, -1000<=ai<=1000). It is known that ai = (ai-1+ai+1)/2-ci for each i=1, 2, ..., n. You are given a0, an+1, c1, ... , cn. Wr
阅读全文
摘要:Max SequenceTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 12213Accepted: 5075DescriptionGive you N integers a1, a2 ... aN (|ai| <=1000, 1 <= i <= N). You should output S.InputThe input will consist of several test cases. For each test case, one integer N (2 <= N <= 100000)
阅读全文
摘要:StepsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6566Accepted: 3006DescriptionOne steps through integer points of the straight line. The length of a step must be nonnegative and can be by one bigger than, equal to, or by one smaller than the length of the previous step. What is the mini
阅读全文
摘要:Set DefinitionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8210Accepted: 3740DescriptionSet S is defined as follows: (1) 1 is in S; (2) If x is in S, then 2x + 1 and 3x + 1 are also in S; (3) No other element belongs to S. Find the N-th element of set S, if we sort the elements in S by i
阅读全文
摘要:Series DeterminationTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5505Accepted: 3601DescriptionBoudreaux and Thibodeaux aren't very good at math, so they need you to write a program that can determine the second degree polynomial used to generate a given sequence of three integers. As
阅读全文
摘要:Keep on Truckin'Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7096Accepted: 5316DescriptionBoudreaux and Thibodeaux are on the road again . . . "Boudreaux, we have to get this shipment of mudbugs to Baton Rouge by tonight!" "Don't worry, Thibodeaux, I already checke
阅读全文
摘要:Blurred VisionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1410Accepted: 1022DescriptionAliasing is the stair-step effect achieved when attempting to represent a smooth curve using a finite number of discrete pixels. Of course, all computer displays consist of a finite number of pixels,
阅读全文
摘要:Hard to Believe, but True!Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3151Accepted: 1784DescriptionThe fight goes on, whether to store numbers starting with their most significant digit or their least significant digit. Sometimes this is also called the "Endian War". The battl
阅读全文
摘要:Jolly JumpersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13224Accepted: 4087DescriptionA sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance, 1 4 2 3 is a jolly jum
阅读全文
摘要:Primary ArithmeticTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8356Accepted: 3122DescriptionChildren are taught to add multi-digit numbers from right-to-left one digit at a time. Many find the "carry" operation - in which a 1 is carried from one digit position to be added to th
阅读全文
摘要:Drink, on IceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1283Accepted: 777DescriptionA good drink is always served on ice. That said, the amount of ice is what makes the difference. If it is too much, the drink will be well cooled, however, this is a bit of fraud as there could be less
阅读全文
摘要:Largest Rectangle in a HistogramTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10329Accepted: 3267DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure
阅读全文
摘要:OnesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8948Accepted: 5061DescriptionGiven any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1's. How many digits are in the smallest such a multiple of n?Input
阅读全文
摘要:Hamming ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5626Accepted: 2528DescriptionFor each three prime numbers p1, p2 and p3, let's define Hamming sequence Hi(p1, p2, p3), i=1, ... as containing in increasing order all the natural numbers whose only prime divisors are p1, p2 o
阅读全文
摘要:WERTYUTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6731Accepted: 3121Description A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You
阅读全文
摘要:Very Simple ProblemTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 3250Accepted: 1211DescriptionDuring a preparation of programming contest, its jury is usually faced with many difficult tasks. One of them is to select a problem simple enough to most, if not all, contestants to solve. The d
阅读全文
摘要:Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 15693Accepted: 7549DescriptionThere 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
阅读全文
摘要:Longest Ordered SubsequenceTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 20871Accepted: 9020DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <
阅读全文
摘要:How much did the businessman loseTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8907Accepted: 5982DescriptionBusinessmen, of course, can make much money. However, sometimes, they would lose money in trading. For example, Jame, a businessman, brought in some goods each cost him 40 yuan and
阅读全文
摘要:Crossed laddersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3984Accepted: 1555DescriptionA narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on the building on the left side. A y foot long lad
阅读全文
摘要:Peter's smokesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 15268Accepted: 6171DescriptionPeter has n cigarettes. He smokes them one by one keeping all the butts. Out of k > 1 butts he can roll a new cigarette. How many cigarettes can Peter have?InputInput is a sequence of lines. E
阅读全文
摘要:BabelfishTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 21485Accepted: 9215DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists
阅读全文
摘要:StuPIdTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 5786Accepted: 2990DescriptionBackground At DUT, the Dreamland University of Technology, all students have personal id, numbers with six or seven digits. But they're not just any numbers. Only those that have a checksum with a zero as
阅读全文
摘要:Binary TreeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4526Accepted: 2124DescriptionBackground Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the nodes contain a pair of integers. The tree is constructed like t
阅读全文
摘要:StrategiesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2385Accepted: 1163DescriptionBackground Bill, Steve and Linus participate in programming contests just like the one you're competing in right now. They have different strategies and we’d like to find out whose strategy is the bes
阅读全文
摘要:Scavenger HuntTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2145Accepted: 1176DescriptionBackground Bill has been the greatest boy scout in America and has become quite a superstar because he always organized the most wonderful scavenger hunts (you know, where the kids have to find a cert
阅读全文
摘要:StampsTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7032Accepted: 3269DescriptionBackground Everybody hates Raymond. He's the largest stamp collector on planet earth and because of that he always makes fun of all the others at the stamp collector parties. Fortunately everybody loves L
阅读全文
摘要:Maximum sumTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 24408Accepted: 7404DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).InputThe input consists of T(<=30) test cases. The number of test cases (T) is given i
阅读全文
摘要:An Easy ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6665Accepted: 3955DescriptionAs we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form. Given a positive integer I, you task is to find out an inte
阅读全文
摘要:Ambiguous permutationsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5192Accepted: 3061DescriptionSome programming contest problems are really tricky: not only do they require a different output format from what you might have expected, but also the sample output does not show the differen
阅读全文
摘要:BeavergnawTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5424Accepted: 3629Description When chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diameter the same as its h
阅读全文
摘要:Hay PointsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5107Accepted: 3303DescriptionEach employee of a bureaucracy has a job description - a few paragraphs that describe the responsibilities of the job. The employee's job description, combined with other factors, such as seniority, i
阅读全文
摘要:Bank InterestTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 11770Accepted: 7008DescriptionFarmer John made a profit last year! He would like to invest it well but wonders how much money he will make. He knows the interest rate R (an integer between 0 and 20) that is compounded annually at
阅读全文
摘要:Who's in the MiddleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 21167Accepted: 12075DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as mu
阅读全文
摘要:Questions and answersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8191Accepted: 4375DescriptionThe database of the Pentagon contains a top-secret information. We don't know what the information is — you know, it's top-secret, — but we know the format of its representation. It is
阅读全文
摘要:Democracy in dangerTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2446Accepted: 1809DescriptionIn one of the countries of Caribbean basin all decisions were accepted by the simple majority of votes at the general meeting of citizens (fortunately, there were no lots of them). One of the loc
阅读全文
摘要:RopeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4377Accepted: 1585DescriptionPlotters have barberically hammered N nails into an innocent plane shape, so that one can see now only heads. Moreover, pursuing their mean object, they have hammered all the nails into the vertices of a convex
阅读全文
摘要:Above AverageTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12258Accepted: 6476DescriptionIt is said that 90% of frosh expect to be above average in their class. You are to provide a reality check.InputThe first line of standard input contains an integer C, the number of test cases. C data
阅读全文
摘要:Rock, Scissors, PaperTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 3106Accepted: 1838DescriptionBart's sister Lisa has created a new civilization on a two-dimensional grid. At the outset each grid location may be occupied by one of three life forms: Rocks, Scissors, or Papers. Each da
阅读全文
摘要:Guessing GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12209Accepted: 4277DescriptionStan and Ollie are playing a guessing game. Stan thinks of a number between 1 and 10 and Ollie guesses what the number might be. After each guess, Stan indicates whether Ollie's guess is too high,
阅读全文
摘要:Rotten RopesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4468Accepted: 2881DescriptionSuppose we have n ropes of equal length and we want to use them to lift some heavy object. A tear-off weight t is associated to each rope, that is, if we try to lift an object, heavier than t with that
阅读全文
摘要:Beat the Spread!Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 15350Accepted: 7297DescriptionSuperbowl Sunday is nearly here. In order to pass the time waiting for the half-time commercials and wardrobe malfunctions, the local hackers have organized a betting pool on the game. Members plac
阅读全文
摘要:Tian Ji -- The Horse RacingTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 7895Accepted: 2446DescriptionHere is a famous story in Chinese history. That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others. Bo
阅读全文
摘要:BullseyeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4201Accepted: 1971DescriptionA simple dartboard consists of a flat, circular piece of cork with concentric rings drawn on it. Darts are thrown at the board by players in an attempt to hit the center of the dartboard (the Bullseye). The
阅读全文
摘要:Goldbach's ConjectureTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 26401Accepted: 10294DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be written as
阅读全文
摘要:#include<iostream>using namespace std;int main(){ int matri[100][100]; int r_state[100]; int l_state[100]; int sum; int l_odd,r_odd; int l_temp,r_temp; int n; int i,j; while(1) { cin>>n; if(n==0) break; for(i=0;i<100;i++) { ...
阅读全文
摘要:Humble NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7754Accepted: 3666DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. W
阅读全文
摘要:Binomial ShowdownTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 14828Accepted: 4549DescriptionIn how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number.InputThe input will contain one or more test cases. Each test ca
阅读全文
摘要:LottoTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5350Accepted: 3401DescriptionIn the German Lotto you have to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn't increase your chance of winning - is to select a subset S containing k (k
阅读全文
摘要:Moo VolumeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 15037Accepted: 4342DescriptionFarmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are making too much noise. FJ's N cows (1 <= N <= 10,000) all graze at various locations on a lon
阅读全文
摘要:The Circumference of the CircleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5444Accepted: 3531DescriptionTo calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't? You are given the cartesian coordinates of three non-c
阅读全文
摘要:Does This Make Me Look Fat?Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1964Accepted: 886DescriptionAs the host of a popular daytime television talk show, you are working through the details of an upcoming episode on dieting. Your guest is the controversial Dr. Kevorkian, who has recentl
阅读全文
摘要:The KingTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 5115Accepted: 2845DescriptionOnce upon a time in a country far away lived a king and he had a big kingdom. He was a very clever king but he had one weakness -- he could count only up to three. Nevertheless, he did not consider this to
阅读全文
摘要:Specialized Four-Digit NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6187Accepted: 4469DescriptionFind and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represented in hexadecimal (base 16) n
阅读全文
摘要:PyramidsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2118Accepted: 696Special JudgeDescriptionRecently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ancient pyramids. But unlike those in Egypt and Central America, they have triangular (not rectangular) f
阅读全文
摘要:ISBNTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12940Accepted: 4507DescriptionFarmer John's cows enjoy reading books, and FJ has discovered that his cows produce more milk when they read books of a somewhat intellectual nature. He decides to update the barn library to replace all of
阅读全文
摘要:Beauty ContestTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 17798Accepted: 5360DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000
阅读全文
摘要:Message DecowdingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9695Accepted: 5322DescriptionThe cows are thrilled because they've just learned about encrypting messages. They think they will be able to use secret messages to plot meetings with cows on other farms. Cows are not known f
阅读全文
摘要:Ancient CipherTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 19448Accepted: 6629DescriptionAncient Roman empire had a strong government system with various departments, including a secret service department. Important documents were sent between provinces and the capital in encrypted form
阅读全文
摘要:Herd SumsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12670Accepted: 7559DescriptionThe cows in farmer John's herd are numbered and branded with consecutive integers from 1 to N (1 <= N <= 10,000,000). When the cows come to the barn for milking, they always come in sequential o
阅读全文
摘要:Vertical HistogramTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13678Accepted: 6569DescriptionWrite a program to read four lines of upper case (i.e., all CAPITAL LETTERS) text input (no more than 72 characters per line) from the input file and print a vertical histogram that shows how man
阅读全文
摘要:Power of CryptographyTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 11648Accepted: 5977DescriptionCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of result
阅读全文
摘要:IP AddressTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 15331Accepted: 8772DescriptionSuppose you are reading byte streams from any device, representing IP addresses. Your task is to convert a 32 characters long sequence of '1s' and '0s' (bits) to a dotted decimal format.
阅读全文
摘要:Grandpa is FamousTime Limit: 2000MSMemory Limit: 30000KTotal Submissions: 6290Accepted: 3164DescriptionThe whole family was excited by the news. Everyone knew grandpa had been an extremely good bridge player for decades, but when it was announced he would be in the Guinness Book of World Records as
阅读全文
摘要:Recaman's SequenceTime Limit: 3000MSMemory Limit: 60000KTotal Submissions: 17487Accepted: 7246DescriptionThe Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not already in the sequence, otherwise am = am−1 + m. The first few numbers in
阅读全文
摘要:To and FroTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 7264Accepted: 4787DescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random letters so as t
阅读全文
摘要:Filling Out the TeamTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8302Accepted: 4572DescriptionOver the years, the people of the great city of Pittsburgh have repeatedly demonstrated a collective expertise at football second to none. Recently a spy has discovered the true source of the ci
阅读全文
摘要:When Can We Meet?Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3425Accepted: 1901DescriptionThe ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibl
阅读全文
摘要:No BrainerTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 18696Accepted: 12495DescriptionZombies love to eat brains. Yum.InputThe first line contains a single integer n indicating the number of data sets. The following n lines each represent a data set. Each data set will be formatted accor
阅读全文
摘要:Speed LimitTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 12579Accepted: 8932DescriptionBill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill has a working stopwatch, so they can record their
阅读全文
摘要:Symmetric OrderTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 9665Accepted: 5953DescriptionIn your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose output is a list of names in nondescending order by length (so that
阅读全文
摘要:Hanafuda ShuffleTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3395Accepted: 1939DescriptionThere are a number of ways to shuffle a deck of cards. Hanafuda shuffling for Japanese card game 'Hanafuda' is one such example. The following is how to perform Hanafuda shuffling. There is
阅读全文
摘要:Gold CoinsTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 16569Accepted: 10398DescriptionThe king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of the next two days (the second and third days of service), the knight receives
阅读全文
摘要:Count on CantonTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8107Accepted: 4733DescriptionOne of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enumerable. The proof works by using an explicit enumeration of rational numbers
阅读全文
摘要:DartsTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 1028Accepted: 573DescriptionBackground Many nations (including Germany) have a strange tradition of throwing small arrows at round flat targets (usually, these small arrows are called darts and so is the game). In a darts game, the target
阅读全文
摘要:World Cup NoiseTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 12396Accepted: 6100DescriptionBackground "KO-RE-A, KO-RE-A" shout 54.000 happy football fans after their team has reached the semifinals of the FIFA World Cup in their home country. But although their excitement is rea
阅读全文
摘要:Ride to SchoolTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 15152Accepted: 6081DescriptionMany graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus – Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to s
阅读全文
摘要:All in AllTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 21170Accepted: 8374DescriptionYou have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in
阅读全文
摘要:StripiesTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8715Accepted: 4287DescriptionOur 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
阅读全文
摘要:CodeTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 5387Accepted: 2487DescriptionTransmitting 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
阅读全文
摘要:AlignmentTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 7394Accepted: 2343DescriptionIn the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of the captain. The captain is not satisfied with the way his soldiers
阅读全文
摘要:SumTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8859Accepted: 5756DescriptionConsider the natural numbers from 1 to N. By associating to each number a sign (+ or -) and calculating the value of this expression we obtain a sum S. The problem is to determine for a given sum S the minimum n
阅读全文
摘要:#include<iostream>#include<algorithm>using namespace std;int main(){ int flag; int m,n,k; int i; int num[1024]; scanf("%d",&m); while(m--) { scanf("%d%d",&n,&k); for(i=0;i<n;i++) { scanf("%d",&num[i]); } for(i=0;i<k;i++) { ...
阅读全文
摘要:BrainmanTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 6739Accepted: 3711DescriptionBackground Raymond Babbitt drives his brother Charlie mad. Recently Raymond counted 246 toothpicks spilled all over the floor in an instant just by glancing at them. And he can even count Poker cards. Charl
阅读全文
摘要:Yeehaa!Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 9195Accepted: 4706DescriptionBackground George B. wants to be more than just a good American. He wants to make his daddy proud and become a western hero. You know, like John Wayne. But sneaky as he is, he wants a special revolver that w
阅读全文
摘要:In DangerTime Limit: 1000MSMemory Limit:30000KTotal Submissions: 3001Accepted:1582DescriptionFlavius Josephus and 40 fellow rebels were trapped by the Romans. His companions preferred suicide to surrender, so they decided to form a circle and to kill every third person and to proceed around the circ
阅读全文
摘要:OrdersTime Limit: 1000MSMemory Limit:10000KTotal Submissions: 7274Accepted:4573DescriptionThe stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the kinds having labels starting with the same letter are stored in the same warehouse (i.e. in the same building)
阅读全文
摘要:Dissatisfying LiftTime Limit: 1000MSMemory Limit:10000KTotal Submissions: 4721Accepted:1013DescriptionThere's a building with M floors. The amounts of tenants of every floor are K1, K2, K3, ..., Km. One day all the tenants went home together and they took the same lift (suppose the lift was larg
阅读全文
摘要:Sorting by SwappingTime Limit: 1000MSMemory Limit:10000KTotal Submissions: 8109Accepted:4300DescriptionGiven a permutation of numbers from 1 to n, we can always get the sequence 1, 2, 3, ..., n by swapping pairs of numbers. For example, if the initial sequence is 2, 3, 5, 4, 1, we can sort them in t
阅读全文
摘要:Biker's Trip OdometerTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4743 Accepted: 3032DescriptionMost bicycle speedometers work by using a Hall Effect sensor fastened to the front fork of the bicycle. A magnet is attached to one of the spokes on the front wheel so that it will line u
阅读全文
摘要:放苹果Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 19066 Accepted: 12079Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。Output对输入的每组数据M和N,用一行输出相应的K。Sample Input17 3 1: #include<iost
阅读全文
摘要:Number StepsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11605 Accepted: 6167DescriptionStarting from point (0,0) on a plane, we have written all non-negative integers 0,1,2, ... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respect
阅读全文
摘要:Eva's ProblemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 14397 Accepted: 8705DescriptionEva的家庭作业里有很多数列填空练习。填空练习的要求是:已知数列的前四项,填出第五项。因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习。Input第一行是数列的数目t(0 <= t <= 20)。以下每行均包含四个整数,表示数列的前四项。约定数列的前五项均为不大于10^5的自然数,等比数列的比值也是自然数。Output对输入的每个数列,输出它的前五
阅读全文
摘要:Distance on ChessboardTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 19434 Accepted: 6745Description国际象棋的棋盘是黑白相间的8 * 8的方格,棋子放在格子中间。如下图所示:王、后、车、象的走子规则如下:王:横、直、斜都可以走,但每步限走一格。后:横、直、斜都可以走,每步格数不受限制。车:横、竖均可以走,不能斜走,格数不限。象:只能斜走,格数不限。写一个程序,给定起始位置和目标位置,计算王、后、车、象从起始位置走到目标位置所需的最少步数。Input第一行是测试数据的组数t(
阅读全文
摘要:Counting BlackTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8396 Accepted: 5398DescriptionThere is a board with 100 * 100 grids as shown below. The left-top gird is denoted as (1, 1) and the right-bottom grid is (100, 100).We may apply three commands to the board:1. WHITE x, y, L //...
阅读全文
摘要:Just the FactsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7334 Accepted: 3881DescriptionThe expression N!, read as "N factorial," denotes the product of the first N positive integers, where N is nonnegative. So, for example, N N! 0 1 1 1 2 2 3 6 4 ...
阅读全文
摘要:A Contesting DecisionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1748 Accepted: 1288DescriptionJudging a programming contest is hard work, with demanding contestants, tedious decisions,and monotonous work. Not to mention the nutritional problems of spending 12 hours with only donuts, p
阅读全文
摘要:Function Run FunTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11932 Accepted: 6255DescriptionWe all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns: 1 if a > 20 or b > 20 or c &g
阅读全文
摘要:Easier Done Than Said?Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3333 Accepted: 1833DescriptionPassword security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated pas
阅读全文
摘要:Haiku ReviewTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 647 Accepted: 393DescriptionHaiku is an ancient form of Japanese poetry. A haiku is a three-line poem with seventeen syllables, where the first line must contain five syllables, the second line must contain seven syllables, and th
阅读全文
摘要:Skew BinaryTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8958 Accepted: 5721DescriptionWhen a number is expressed in decimal, the kth digit represents a multiple of 10k. (Digits are numbered from right to left, where the least significant digit is number 0.) For example, 81307(10) = 8 *
阅读全文
摘要:DoublesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 15059 Accepted: 8519DescriptionAs part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some
阅读全文
摘要:Clay BullyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7342 Accepted: 4097DescriptionMs. Terry is a pre-school art teacher who likes to have her students work with clay. One of her assignments is to form a lump of clay into a block and then measure the dimensions of the block. However,
阅读全文
浙公网安备 33010602011771号