본문 바로가기

PKU & UVa problems/Original problem

PKU 2234. Matches Game Matches Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2658 Accepted: 1536 Description Here is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitrary number of matches from the pile (Of course the number of matches, which is taken away, cannot be zero and cannot be .. 더보기
PKU 2243. Knight Moves Knight Moves Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3541 Accepted: 2177 Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard exactly once. He thinks that the most difficult part of the problem is determining the smal.. 더보기
PKU 2840. Big Clock Big Clock Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 4397 Accepted: 2802 Description Our 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. After the clock was repaired, it works all right, but there is still something wrong with it: t.. 더보기
PKU 2656. Unhappy Jinjin Unhappy Jinjin Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5645 Accepted: 4199 Description Jinjin 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 will be unhappy on that day. On any day she gets unhappy, the more time she studies, the unhappi.. 더보기
PKU 1163. The Triangle The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13569 Accepted: 7789 Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right. In.. 더보기
PKU 2039. To and Fro To and Fro Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4308 Accepted: 2832 Description Mo 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 to make a rectangular array of letters. For example, if the message is "There’s no place like.. 더보기
UVa 324. Factorial Frequencies 324 - Factorial FrequenciesTime limit: 3.000 seconds Factorial Frequencies In an attempt to bolster her sagging palm-reading business, Madam Phoenix has decided to offer several numerological treats to her customers. She has been able to convince them that the frequency of occurrence of the digits in the decimal representation of factorials bear witness to their futures. Unlike palm-reading, how.. 더보기
PKU 1455. Crazy Tea Party Crazy tea party Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4055 Accepted: 2736 Description n participants of > sit around the table. Each minute one pair of neighbors can change their places. Find the minimum time (in minutes) required for all participants to sit in reverse order (so that left neighbors would become right, and right - left). Input The first line is the amount of .. 더보기
PKU 2719. Faulty Odometer Faulty Odometer Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5004 Accepted: 3159 Description You 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 defect shows up in all positions (the one's, the ten's, the hundred's, etc.). For example, if.. 더보기
UVa 200. Rare Order Rare Order A rare book collector recently discovered a book written in an unfamiliar language that used the same characters as the English language. The book contained a short index, but the ordering of the items in the index was different from what one would expect if the characters were ordered the same way as in the English alphabet. The collector tried to use the index to determine the order.. 더보기
PKU 2551. Ones Ones Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5098 Accepted: 2912 Description Given any integer 0 더보기
PKU 1904. King's Quest King's Quest Time Limit: 15000MS Memory Limit: 65536K Total Submissions: 1493 Accepted: 494 Case Time Limit: 2000MS Description Once upon a time there lived a king and he had N sons. And there were N beautiful girls in the kingdom and the king knew about each of his sons which of those girls he did like. The sons of the king were young and light-headed, so it was possible for one son to like sev.. 더보기
PKU 1953. World Cup Noise World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5818 Accepted: 2851 Description Background "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 real, the Korean people are still very organized by nature. For example, they have organized huge trumpets.. 더보기
PKU 2845. 01000001 01000001 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5031 Accepted: 1654 Description Adding 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 left. Unlike decimal addition, there is little to memorize in the way of rules for the addit.. 더보기
PKU 1089. Intervals Intervals Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2973 Accepted: 1158 Description There is given the series of n closed intervals [ai; b i], where i=1,2,...,n. The sum of those intervals may berepresented as a sum of closed pairwise non−intersecting intervals. The task is to find such representation with the minimal number of intervals. The intervals of this representation sho.. 더보기
PKU 1298. The Hardest Problem Ever The Hardest Problem Ever Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8523 Accepted: 4866 Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ciphers. This cipher was so incredibly sound, that no one could figure it out without knowing .. 더보기
PKU 3438. Look and Say Look and Say Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2978 Accepted: 1905 Description The 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" describing the previous element. For example, the string 122344111 can be described as "one 1, two 2's, .. 더보기
PKU 3030. Nasty Hacks Nasty Hacks Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3479 Accepted: 2596 Description You 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 time to sell it. You want to make as much money as possible and consider advertising in order.. 더보기
PKU 2521. How much did the businessman lose How much did the businessman lose Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5019 Accepted: 3449 Description Businessmen, 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 he decided to sell at the price of 70 yuan. Then a customer came to buy one, gave Jame 100 y.. 더보기
PKU 2636. Elecrical Outlets Electrical Outlets Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3730 Accepted: 2806 Description Roy 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 apartment has only one single wall outlet, so Roy can only power one of his electrical applianc.. 더보기
PKU 1979. Red and Black Red and Black Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3868 Accepted: 2523 Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles. Write a program to count the number of .. 더보기
PKU 3094. Quicksum Quicksum Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3382 Accepted: 2397 Description A 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 transmission errors, validating document contents, and in many other situations where it is necess.. 더보기
PKU 3077. Rounders Rounders Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3128 Accepted: 2031 Description For 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) take that number and round it to the nearest thousand, and so on ... Input Input to this p.. 더보기
PKU 2388. Who's in the Middle Who's in the Middle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7089 Accepted: 4265 Description FJ 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 much or less. Given an odd number of cows N (1 더보기
PKU 1804. Brainman. Brainman Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3041 Accepted: 1737 Description Background 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. Charlie would love to be able to do cool things like that, too. He wants to beat his brother in a.. 더보기
PKU 2649: Factovisors Factovisors Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1620 Accepted: 431 Description The factorial function, n! is defined thus for n a non-negative ingeger: 0! = 1 n! = n * (n-1)! (n > 0) We say that a divides b if there exists an integer k such that k*a = b Input The input to your program consists of several lines, each containing two non-negative integers, n and m, both less .. 더보기
PKU 1844. Sum. Sum Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4816 Accepted: 3123 Description Consider 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 number N for which we can obtain S by associating signs for all numbers between 1 to N. For a.. 더보기
PKU [3685]. Matrix. Matrix Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 2290 Accepted: 415 Description Given a N × N matrix A, whose element in the i - th row and j - th column Ai j is an number that equals i 2 + 100000 × i + j 2 - 100000 × j + i × j, you are to find the M - th smallest element in the matrix. Input The first line of input is the number of test case. For each test case there is only on.. 더보기
PKU 2017, Speed Limit. Speed Limit Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6123 Accepted: 4485 Description Bill 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 speed and the total time they have driven. Unfortunately, their record keeping strategy is a litt.. 더보기
PKU [2027]. No Brainer. No Brainer Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7468 Accepted: 5631 Description Zombies love to eat brains. Yum. Input The 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 according to the following description: A single data set consists of a line "X Y", where X is th.. 더보기