본문 바로가기

problem solving/Problem Solving

Cake Cutting Description You are given a rectangular cake of integral dimensions w × h. Your goal is to divide this cake into m rectangular pieces of integral dimensions such that the area of the largest piece is minimal. Each cut must be a straight line parallel to one of the sides of the original cake and must divide a piece of cake into two new pieces of positive area. Note that since a cut divides only a.. 더보기
Triangle http://acm.pku.edu.cn/JudgeOnline/problem?id=2954 Description A lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the number of lattice points which lie completely inside of the triangle (points on the edges or vertices of the triangle do not count). Input The input te.. 더보기
Square http://acm.pku.edu.cn/JudgeOnline/problem?id=2362 Description Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The first line of input contains N, the number of test cases. Each test case begins with an integer 4 더보기
Ubiquitous Religions http://acm.pku.edu.cn/JudgeOnline/problem?id=2524 Description There 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 university believe in. You know that there are n students in your university (0 < n 더보기
MPI Maelstrom http://acm.pku.edu.cn/JudgeOnline/problem?id=1502 Description BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research advisor, Jack Swigert, has asked her to benchmark the new system. ``Since the Apollo is a distributed shared memory machine, memory access a.. 더보기
Tri Tiling http://acm.pku.edu.cn/JudgeOnline/problem?id=2663 Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. Input Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 더보기
4 Values whose Sum is 0 http://acm.pku.edu.cn/JudgeOnline/problem?id=2785 Time Limit: 15000MS Case Time Limit: 5000MS Description The 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 a + b + c + d = 0 . In the following, we assume that all lists have the same size n . Input The first line of the input file co.. 더보기
Palindrome Numbers http://acm.pku.edu.cn/JudgeOnline/problem?id=2402 Description A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, the name "anna" is a palindrome. Numbers can also be palindromes (e.g. 151 or 753357). Additionally numbers can of course be ordered in size. The first few palindrome numbers are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, ... The number 10 i.. 더보기
Sum of Factorials http://acm.pku.edu.cn/JudgeOnline/problem?id=1775 Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics,meteorology, science, computers, and game theory. He was noted for a phenomenal memory and the speed with which he absorbed ideas and solved problems. In.. 더보기
Crazy tea party http://acm.pku.edu.cn/JudgeOnline/problem?id=1455 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 tests. Each next line contains one integer n (1 더보기