[Tutor] Help with input/output

Olexander olexander.dubrovsky at viart.com.ua
Tue Mar 25 17:13:24 CET 2008


please could you help me with input processing for olympiad problems.
For example, what would be the code for input and output of this


The input file contains several test cases. The first line of each test case contains two integers A and D separated by a single space indicating, respectively, the number of attacking and defending players involved in the play (2 <= A,D <= 11). The next line contains A integers Bi separated by single spaces, indicating the distances of the attacking players to the goal line (1 <= Bi <= 104). The next line contains D integers Cj separated by single spaces, indicating the distances of the defending players to the goal line (1 <= Cj <= 104). The end of input is indicated by A = D = 0.

For each test case in the input print a line containing a single character: “Y” (uppercase) if there is an attacking player offside, and “N” (uppercase) otherwise.

2 3
500 700
700 500 500
2 2
200 400
200 1000
3 4
530 510 490
480 470 50 310
0 0


I also wonder how to output several integers in one line.
Thank you.

More information about the Tutor mailing list