TEST - Life, the Universe, and Everything

Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.

Example

Input:
1
2
88
42
99

Output:
1
2
88

Information

In case of any problems with your code, you can take a look in the forum, you'll find the answer, only for this problem, in various languages.


Added by:mima
Date:2004-05-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Douglas Adams, The Hitchhiker's Guide to the Galaxy

hide comments
2024-09-29 06:46:59
Hello there,
May I know how many exact inputs will be given to the program?. For now I just assumed it as 5, previously I assumed that it has to take inputs until the value "42" is given to it, but both are wrong it seems
2024-09-26 20:27:16
<snip>
tôi sai ở đâu nhỉ ???
[Simes]: remove the "public" on the class declaration.


Last edit: 2024-09-27 00:47:33
2024-09-19 11:13:43
<snip>
whats wrong in this solution i think it should work. i am coding it in java so any java coders help me out
[Simes]: there's nothing wrong with that code. It got AC when I submitted it.

Last edit: 2024-09-19 17:20:23
2024-09-08 10:05:21
bro can anyone explain what we should do, i have wrote the code for user given values, self assumed values, but nothing is right
[Simes]: read the values from standard input. Don't write anything not given in the example, so no prompts or messages,

Last edit: 2024-09-08 19:43:37
2024-08-30 19:56:18
<snip>
not able to submit, but my code is right
[Simes]: what if the input is split across multiple lines?

Last edit: 2024-08-31 07:20:15
2024-08-30 19:39:23
<snip>
#is this correct ?
[Simes]: Not quite, your output must match the expected output exactly, so try it without the prompt.

Last edit: 2024-08-31 07:17:52
2024-08-13 11:31:56
在SPOJ AC的第一道题目
[Simes]: "The first question in SPOJ AC" - You do realise your submission history is publicly accessible don't you?

Last edit: 2024-08-14 19:50:27
2024-08-10 04:17:35
<snip>
My codes is right ,but your website keep telling that it it wrong answer. WHY???
[Simes]: try putting some newlines between the numbers.

Last edit: 2024-08-12 20:03:47
2024-07-26 16:04:19
use this line of code:

int n;
while(cin >> n){
//code here
}

Last edit: 2024-07-26 16:26:41
2024-07-24 15:15:14
uAKIOI
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.