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

If you have some troubles 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:Michał Małafiejski
Date:2004-05-01
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All
Resource:Douglas Adams, The Hitchhiker's Guide to the Galaxy

hide comments
ranjeet324: 2015-07-27 21:59:38

my code is giving correct output but here showing wrong answer why???

aayush95: 2015-07-25 19:41:11

my prog is taking 5 input and stopping at 42 bt still getting runtime error need help!!!

adi_tri: 2015-07-25 19:21:52

gud problem for beginners..:)

Last edit: 2015-07-25 19:31:18
Anant Upadhyay: 2015-07-25 19:18:07

BE CAREFUL ABOUT \n

Last edit: 2015-07-26 06:28:25
omk: 2015-07-20 20:31:40

What is brute-force ?

ackharsha: 2015-07-19 11:27:28

My code is giving output correctly in turboC compiler but if i submit in spoj it is giving compilation error.#Please help!!!#

fsociality: 2015-07-19 06:37:31

Can I do this code in JAVA?

damianek_911: 2015-07-18 22:29:08

Nice problem

jasprit_bawa: 2015-07-16 17:11:28

program runs accurately on my pc in java 7.6 but here it is showing compilation error can someone help me on this?

mukul003007: 2015-07-11 11:47:08

just want to clarify the newbees here that in the example its not the output screen ....


Problem's scores 2 votes

Concept difficulty
Concept difficulty 4%
Implementation difficulty
Implementation difficulty 6%
78 18