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 ...
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 ...
Last year we set a problem on bachelor arithmetic which made some bachelors really unhappy. So to even things up, we are making a problem on the tough schedule of a married man. ...
The inhabitants of Nlogonia are very superstitious. One of their beliefs is that street house numbers that have a repeated digit bring bad luck for the residents. Therefore, they would never live in a...
EXTENDED LIGHTS OUT Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16345 Accepted: 9867 Description In an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons ...
And Then There Was One Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 5973 Accepted: 3269 Description Let’s play a stone removing game. Initially, n stones are arranged on a circle and ...
John Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3727 Accepted: 1863 Description Little John is playing very funny game with his younger brother. There is one big box filled with M&am...
Factorial Frequencies Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2927 Accepted: 1252 Description In an attempt to bolster her sagging palm-reading business, Madam Phoenix has decided...
Joseph’s Problem Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7906 Accepted: 2107 Description Joseph likes taking part in programming contests. His favorite problem is, of course, ...
During Frosh Week, students play various fun games to get to know each other and compete against other teams. In one such game, all the frosh on a team stand in a line, and are then asked to arrange t...
A palindrome is a sequence of one or more characters that reads the same from the left as it does from the right. For example, Z, TOT and MADAM are palindromes, but ADAM is not. ...
The inhabitants of Tigerville and Elephantville are engaged in a seasonal war. Last month, Elephantville successfully launched and orbited a spy telescope called the Bumble Scope. The purpose of the B...
标签: uva
蓝书第一章的题目,神奇的解法:详细见P50,City Game LA3029, UVa 1330#include #include #include #include #include #include using namespace std; typedef long long L
The knight is a piece used in chess, a game played on a board with squares arranged in rows and columns. A knight attacks pieces that are either (a) two rows and one column away from its position, or ...
Write a program to identify the youngest person and the oldest person in a class. Input The number n (1 ≤ n ≤ 100) in the first line determines the number of people in a class. The following n lines...
Word Index Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5333 Accepted: 3011 Description Encoding schemes are often used in situations requiring encryption or information storage/...
The early Greeks have made great contributions to the field of mathematics. Among the great mathematicians of this times were Euclid and Pythagoras. The 23 volume Elements of Euclid is still regarded ...
Heidi has a discrete analog clock in the shape of a circle, as the one in the figure. Two hands rotate around the center of the circle, indicating hours and minutes. The clock has 60 marks placed arou...
Station Balance Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 611 Accepted: 220 Special Judge Description The International Space Station contains many centrifuges in its labs....
We suspect that for every positive integer N there exists an integer of the form 11 . . . 10 . . . 0 (a sequence of 1’s followed by 0 or more 0’s) that is divisible by N. For example, with N = 3, ...
Richard Phillips Feynman was a well known American physicist and a recipient of the Nobel Prize in Physics. He worked in theoretical physics and also pioneered the field of quantum computing....
Oreon Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2245 Accepted: 596 Description In the 25th century, civilization is struck by a series of calamities that eventually led mankind to b...
The standard interpretation of the binary number 1010 is 8 + 2 = 10. An alternate way to view the sequence “1010” is to use Fibonacci numbers as bases instead of powers of two. For this problem, the...
Count Mathias Sandorf, a hero of Jules Verne, encrypted the secret messages of the Trieste conspirators by using a cipher key a 6×6 hard paper square with some holes in it. In figure 1 the holes are ...
The probability of n heads in a row tossing a fair coin is 2−n Input The first line of the input contains an integer r. Then r lines containing each one an integer number n. The value of n is as ...
#include #include #define MAX(x,y) ((x)>(y)?(x):(y)) int d1[5100],d2[5100],n; int ok(int num) { int l=0,r=0,k=0,l1=0,r1=0; for(int i=0;i;i++) { int t=0; l+=d1[i]; r+=d2[i];... {
Sorting an array can be done by swapping certain pairs of adjacent entries in the array. This is the fundamental technique used in the well-known bubble sort. If we list the identities of the pairs to...
Mr. Bean used to have a lot of problems packing his suitcase for holiday. So he is very careful for this coming holiday. He is more serious this time because he is going to meet his fiance and he is a...
Wordfish Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1082 Accepted: 535 Description You have been tasked to infiltrate a tight-lipped society for fun and profit: the ACM ICPC ...
Description Programming contests became so popular in the year 2397 that the governor of New Earck — the largest human-inhabited planet of the galaxy — opened a special Alley of Contestant Memories ...