Odds or evens? P33650


Statement
 

pdf   zip

html

Ana and Bernardo play to “odds or evens”. In each round, first they agree a certain number n. Then, both of them choose a number at random between 0 and n, and they write it down in a paper without the other player can see it. Afterwards, Bernardo conjectures if the sum of the two number is an odd or an even number. With the two numbers in the papers they check if he is right and he has won or, otherwise, Ana has won.

For each round, we know n, the number that has conjectured Bernardo and who has won that round. Implement a program that prints all the combinations of numbers chosen by Ana and Bernardo that are solid with that information.

Input

The input contains the number k<100 of rounds in a line followed by k lines, each one describing a round. Each round consist of a n between 1 and 100, the conjecture of Bernardo, and who has won the round, separated by spaces.

Your program must solve an input as the one described in 1 second of time.

Output

For each round, your program must print (starting in 1), followed by all the combinations that are coherent with the information about that round, one per line and in increasing order. It must print a line in white after each round, the last one also.

Public test cases
  • Input

    4
    3 evens Bernardo
    3 evens Ana
    2 odds Bernardo
    1 odds Ana
    

    Output

    round 1
    0 0
    0 2
    1 1
    1 3
    2 0
    2 2
    3 1
    3 3
    
    round 2
    0 1
    0 3
    1 0
    1 2
    2 1
    2 3
    3 0
    3 2
    
    round 3
    0 1
    1 0
    1 2
    2 1
    
    round 4
    0 0
    1 1
    
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++ Haskell Python