본문 바로가기

PKU & UVa problems/Original problem

PKU 3074. Sudoku Sudoku Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5294 Accepted: 1578 Description In the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgrids. For example, . 2 7 3 8 . . 1 . . 1 . . . 6 7 3 5 . . . . . . . 2 9 3 . 5 6 9 2 . 8 . . . . . . . . . . . 6 . 1 7 4 5 . 3 6 4 . . . . . . . 9 5 1 8 . . . 7 . . 8 . . 6 5 3 4 . Given some of the numbers in the.. 더보기
PKU 3364. Black and white painting Black and white painting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2092 Accepted: 1396 Description You 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 columns like in a chess board (no two adjacent squares have the same colour). By the way, the .. 더보기
UVa 628. Passwords 628 - PasswordsTime limit: 3.000 seconds Passwords Having several accounts on several servers one has to remember many passwords. You can imagine a situation when someone forgets one of them. He/she remembers only that it consisted of words x, y and z as well as two digits: one at the very beginning and the other one at the end of the password. Your task is to write a program which will generate.. 더보기
PKU 3132. Sum of Different Primes Sum of Different Primes Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2398 Accepted: 1474 Description A positive integer may be expressed as a sum of different prime numbers (primes), in one way or another. Given two positive integers n and k, you should count the number of ways to express n as a sum of k different primes. Here, two ways are considered to be the same if they sum up .. 더보기
PKU 2291. Rotten Ropes Rotten Ropes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4023 Accepted: 2620 Description Suppose 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 rope, it will tear off. But we can fasten a number of ropes to the heavy object (in parallel.. 더보기
PKU 2181. Jumping Cows Jumping Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4560 Accepted: 2761 Description Farmer John's cows would like to jump over the moon, just like the cows in their favorite nursery rhyme. Unfortunately, cows can not jump. The local witch doctor has mixed up P (1 더보기
PKU 3032. Card Trick Card Trick Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2541 Accepted: 1854 Description The 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 is the Ace of Spades. Two cards are moved one at a time from the top to the bottom. The next.. 더보기
PKU 3176. Cow Bowling Cow Bowling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7685 Accepted: 5014 Description The 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 8 1 0 2 7 4 4 4 5 2 6 5Then the other cows traverse the triangle starting from its tip and moving "down" to on.. 더보기
PKU 3085. Quick Change Quick Change Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3979 Accepted: 2914 Description J.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 a tightwad, figures he loses more money from these mistakes than he makes; that is, the emp.. 더보기
PKU 2260. Error Correction Error Correction Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3990 Accepted: 2641 Description A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property: 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 The sums of the rows are 2, 0, 4 and 2. The sums of the columns a.. 더보기
UVa 341. Non-Stop Travel 341 - Non-Stop TravelTime limit: 3.000 seconds Non-Stop Travel David hates to wait at stop signs, yield signs and traffic signals while driving. To minimize this aggravation, he has prepared maps of the various regions in which he frequently drives, and measured the average delay (in seconds) at each of the various intersections in these regions. He wants to find the routes between specified poi.. 더보기
PKU 1050. To the Max To the Max Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20504 Accepted: 10588 Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the sub-rectangle with the largest sum is.. 더보기
PKU 1422. Air Raid Air Raid Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2879 Accepted: 1701 Description Consider 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 an intersection and walking through town's streets you can never reach the same intersection i.e. the town's streets form no cycles. With these assumptions .. 더보기
PKU 2844. Sum and Product. 스풰샬 스퉤이지~ For a sequence of N integers A1, A2, ... , AN, we can calculate their sum S and product P easily. With given N, S and P, can you find out the sequence A1, A2, ... , AN? Input The input only contains a line with three integers N, S and P. Here N is positive and not more than 1000000, and the absolute values of S and P do not exceed 150000000. Output Just output "No solution" if there is no such s.. 더보기
PKU 2245. Lotto Lotto Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3799 Accepted: 2458 Description In 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 > 6) of these 49 numbers, and then play several games with choosing numbers only from S. For exa.. 더보기
PKU 2390. Bank Interest Bank Interest Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8868 Accepted: 5327 Description Farmer 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 his bank. He has an integer amount of money M in the range 100..1,000,000. He knows how many .. 더보기
PKU 2871. A Simple Question of Chemistry A Simple Question of Chemistry Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4199 Accepted: 2809 Description Your 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 up with the brilliant idea that you will monitor the temperature of your mixture every minu.. 더보기
PKU 3589. Number-guessing Game Number-guessing Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3240 Accepted: 2406 Description Larry 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 digits, keeping it in mind, and tells Y to start guessing. Every time Y has guessed, X shoul.. 더보기
UVa 562. Dividing Coins Dividing coins It's commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce, they stretched the coin to great length and thus created copper-wire. Not commonly known is that the fighting started, after the two Dutch tried to divide a bag with coins between the tw.. 더보기
PKU 3372. Candy Distribution Candy Distribution Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3678 Accepted: 1902 Description N 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 No.2 a candy each. Then he walks clockwise along the circle, skipping one child (child No... 더보기
PKU 3224. Go for Lab Cup! Go for Lab Cup! Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 5062 Accepted: 2672 Description The 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 lab in the competition. Limited by the quota, however, only one of them can be selected to .. 더보기
PKU 1989. The Cow Lineup The Cow Lineup Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3397 Accepted: 2028 Description Farmer John's N cows (1 더보기
PKU 1547. Clay Bully Clay Bully Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4783 Accepted: 2896 Description Ms. 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, in every class, there is always one child who insists on taking some clay from some other chil.. 더보기
PKU 2000. Gold Coins Gold Coins Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 11700 Accepted: 7242 Description The 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 two gold coins. On each of the next three days (the fourth, fifth, and sixth days of service.. 더보기
PKU 2853. Sequence Sem Possibilities Sequence Sum Possibilities Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3213 Accepted: 2159 Description Most positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance,6 = 1 + 2 + 3 9 = 5 + 4 = 2 + 3 + 4but 8 cannot be so written. Write a program which will compute how many different ways an input number may be written as a s.. 더보기
PKU 2665. Trees Trees Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5383 Accepted: 3713 Description The 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 how many trees are left. Let's only consider one side of the road. Assume that trees were plan.. 더보기
PKU 3210. Coins Coins Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 4206 Accepted: 2615 Description Snoopy 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 initial configuration of the coins, he could always achieve the goal by doing exactly two fl.. 더보기
PKU 3673. Cow Multiplication Cow Multiplication Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4984 Accepted: 3304 Description Bessie 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 digits of A and B. For example, the product 123*45 is equal to 1*4 + 1*5 + 2*4 + 2*5 + 3*4 +.. 더보기
UVa 300. Maya Calendar 300 - Maya CalendarTime limit: 3.000 seconds Maya Calendar During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz,.. 더보기
PKU 1218. THE DRUNK JAILER THE DRUNK JAILER Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 10751 Accepted: 6990 Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked. One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink of whiskey,and then runs down the hall unlocking.. 더보기