935 - 2016高程Exam1 Scoreboard

Time

2016/03/30 18:40:00 2016/03/30 22:50:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10973 Compound Words
10974 Sumsets
10975 500!
10976 Goldbach's Conjecture

10973 - Compound Words   

Description

You are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.

 

Input

Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 120,000 words. Each word will be no longer than 30.

 

Output

Your output should contain all the compound words, one per line, in alphabetical order.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




10974 - Sumsets   

Description

Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S.

 

Input

Several S, each consisting of a line containing an integer 1 ≤ n ≤1000 indicating the number of elements in S, followed by the elements of S, one per line. Each element of S is a distinct integer between -536870912 and +536870911 inclusive. The last line of input contains ’0’.

 

Output

For each S, a single line containing d, or a single line containing "no solution".

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




10975 - 500!   

Description

In these days you can more and more often happen to see programs which perform some useful calculations being executed rather than trivial screen savers. Some of them check the system message queue and in case of finding it empty (for examples somebody is editing a file and stays idle for some time) execute its own algorithm.

As an examples we can give programs which calculate primary numbers.

One can also imagine a program which calculates a factorial of given numbers. In this case it is not the time complexity of order O(n) which makes troubles, but the memory requirements. Considering the fact that 500! gives 1135-digit number. No standard, neither integer nor floating, data type is applicable here.

Your task is to write a programs which calculates a factorial of a given number.

 

Input

Any number of lines, each containing value n for which you should provide value of n!

 

Output

2 lines for each input case. First should contain value n followed by character ‘!’. The second should contain calculated value n!.

Assumptions:

        • Value of a number n which factorial should be calculated of does not exceed 1000 (although 500! is the name of the problem, 500 is a small limit).

        • Mind that visually big number of case 4 is broken in several lines, but this is not the case in the real output file.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




10976 - Goldbach's Conjecture   

Description

In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:

Every number greater than 2 can be written as the sum of three prime numbers.

Goldbach cwas considering 1 as a primer number, a convention that is no longer followed. Later on, Euler re-expressed the conjecture as:

Every even number greater than or equal to 4 can be expressed as the sum of two prime numbers.

For example:

        8 = 3 + 5. Both 3 and 5 are odd prime numbers.

        20 = 3 + 17 = 7 + 13.

        42 = 5 + 37 = 11 + 31 = 13 + 29 = 19 + 23.

Today it is still unproven whether the conjecture is right. (Oh wait, I have the proof of course, but it is too long to write it on the margin of this page.)

Anyway, your task is now to verify Goldbach's conjecture as expressed by Euler for all even numbers less than a million.

 

Input

The input file will contain one or more test cases.

Each test case consists of one even integer n with 6 < n < 1000000

Input will be terminated by a value of 0 for n.

 

Output

For each test case, print one line of the form n = a + b, where a and b are odd primes. Numbers and operators should be separated by exactly one blank like in the sample output below. If there is more than one pair of odd primes adding up to n, choose the pair where the difference b - a is maximized.

If there is no such pair, print a line saying "Goldbach's conjecture is wrong."

 

Sample Input  Download

Sample Output  Download

Tags




Discuss