본문 바로가기

problem solving/Problem Solving

Prime Path http://acm.pku.edu.cn/JudgeOnline/problem?id=3126 Description The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of security to change such things every now and then, to keep the enemy in the dark. — But look, I have chosen my number 1033 for good reasons.. 더보기
Ugly Number http://acm.pku.edu.cn/JudgeOnline/problem?id=1338 Description Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... shows the first 10 ugly numbers. By convention, 1 is included. Given the integer n,write a program to find and print the n'th ugly number. Input Each line of the input contains a postisive integer n (n 더보기
Subsequence http://acm.pku.edu.cn/JudgeOnline/problem?id=3061 Description A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subsequence of consecutive elements of the sequence, the sum of which is greater than or equal to S. Input The first line is the number of .. 더보기
Center of symmetry http://acm.pku.edu.cn/JudgeOnline/problem?id=2526 Description Given is a set of n points with integer coordinates. Your task is to decide whether the set has a center of symmetry. A set of points S has the center of symmetry if there exists a point s (not necessarily in S) such that for every point p in S there exists a point q in S such that p-s = s-q. Input The first line of input contains a n.. 더보기
All in All http://acm.pku.edu.cn/JudgeOnline/problem?id=1936 Description You 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 detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to wr.. 더보기
Risk http://acm.pku.edu.cn/JudgeOnline/problem?id=1603 Description Risk is a board game in which several opposing players attempt to conquer the world. The gameboard consists of a world map broken up into hypothetical countries. During a player's turn, armies stationed in one country are only allowed to attack only countries with which they share a common border. Upon conquest of that country, the ar.. 더보기
Tug of War http://acm.pku.edu.cn/JudgeOnline/problem?id=2576 Description A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other; the number of people on the two teams must not differ by more than 1; the total weight of the people on each team should be as nearly equal as possible. Input The f.. 더보기
Ones http://acm.pku.edu.cn/JudgeOnline/problem?id=2551 Description Given any integer 0 더보기