Submit | All submissions | Best solutions | Back to list |
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-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 |
||||||||||||||
2024-07-11 11:48:21
a=[1,2,88,42,99] for num in a: if num==42: break print (num) is this wrong answer? But it’s actually working. [Simes]: yes, it's wrong because the example I/O is just that - an example. Your progam will be tested with different values, unknown to you, that your program must read from the standard input. Last edit: 2024-07-15 22:36:50 |
||||||||||||||
2024-06-28 10:50:48
Here's a Python solution using a simple loop: python <snip> Explanation: 1. We use an infinite loop (while True) to keep reading input. 2. For each input number, we check if it equals 42. 3. If it is, we break out of the loop. 4. Otherwise, we print the number. [Simes]: No thanks, people are encouraged to write their own solutions. Last edit: 2024-06-28 11:18:08 |
||||||||||||||
2024-05-30 04:11:27
can you tell me is the input wrong or something else is off in my code :-<snip> [Simes]: this is not the place for debugging code, please use the forum. Last edit: 2024-05-30 07:22:31 |
||||||||||||||
2024-05-27 05:53:35
AI? |
||||||||||||||
2024-05-26 20:51:15
not able to submit, my code is right then also your fucking website keep telling that it it wrong answer it is running on your idoneit website |
||||||||||||||
2024-04-23 02:50:50
wouhhh |
||||||||||||||
2024-04-16 02:52:17
Yoo shaa shaa |
||||||||||||||
2024-03-06 02:14:45
peh |