EXPECT - Life, the Universe, and Everything (Interactive)

no tags 

Note for Interactive problem setters: if you are stucked on how to write a interactive problem judge, you may send a mail to "blue.mary.me@qq.com". It will send you the custom judge of this problem.

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.

Interactive Protocol

You should communicate with Judge using standard input and output.

Attention: the program should clear the output buffer after printing each line.

It can be done using fflush(stdout) command or by setting the proper type of buffering at the beginning of the execution - setlinebuf(stdout).

Each time the judge will give you a number. You should rewrite this number to standard output. If this number equals 42, after rewriting your program should terminate immediately.

Example

The example of communication.

Input:
3
15
42

Output:
3
15
42

Attention: the program should clear the output buffer after printing each line.

Reference

Please pay attention that: your program should NOT output any extra characters like "J","P" or “:". Follow the interactive protocol strictly. A sample program (in C++) that can get Accepted is as the following:


hide comments
satyasashi: 2019-02-07 15:20:49

It says time limit exceeded. I used Python with While Loop. Can anyone tell me how to do it in Python?

lalji123: 2019-01-30 16:54:33

can anyone explain me what this question want to say it

indu_123: 2019-01-01 06:25:34

I didn't understand that question.
Please give the reference in java

rishusahu23: 2018-11-03 06:06:37

can anyone give solution, please

baje_cele01: 2018-09-16 16:21:57

This question is not understandable.

paretos_4: 2018-08-30 03:23:35

Is there any 'fflushing' in pyhton 3.x ??

jazz_sprouse: 2018-06-25 08:35:53

how to test

akiakhilesh47: 2018-04-18 14:07:40

question is not understandable..

mahesh_1997: 2018-03-25 06:49:01

What is fflush
How to do it in java

flash22: 2018-03-21 07:42:16

.

Last edit: 2018-03-21 07:43:05

Added by:Fudan University Problem Setters
Date:2008-05-24
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: C99 ERL GOSU JS-RHINO NODEJS PERL6 VB.NET
Resource:A sample of Interactive problems