The Magic Number
Totos is preparing to guess the magic number and win in the lucky game with the same name. To do this, he decided to create the following program on his computer to practice.
Initially, the program will read the magic number from the input.
Then, it will read some numbers, as many as needed, until it finds one that matches the magic number.
For each number it reads, it will print to the output:
1
, if the number read is smaller than the magic number,2
, if the number read is greater than the magic number,0
, when the number read equals the magic number.
Examples
1st
Input
100
5
100
Output
1
0
Explanation of the first example:
The input contains the magic number 100
and guesses, 5
and 100
.
The output first prints 1
because , and then prints 0
because .
2nd
Input
10
11
9
12
10
Output
2
1
2
0
Explanation of the second example:
The input contains the magic number 10
and guesses: 11
, 9
, 12
, and 10
.
The output first prints 2
because , then 1
because , followed by 2
because , and finally 0
because .
3d
Input
10
3
10
11
Output
1
0
Explanation of Example 3:
The input contains the magic number 10
and guesses: 3
, 10
, and 11
.
The output first prints 1
because , and then prints 0
because .
No further numbers are printed because the program stopped when the magic number was found.
Comments