Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Interactive {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- int i1, i2, mosse = 2*n;
- int numMatch = 0;
- for (int i = 0; i < mosse; i++) {
- if(numMatch==n) {
- System.out.printf("-1");
- System.out.flush();
- return;
- }
- for (int j = i+1; j < mosse; j++) {
- System.out.printf("%d %d", i+1, j+1);
- System.out.flush();
- String lettura = in.next();
- if(lettura.equalsIgnoreCase("MATCH")) {
- numMatch++;
- break;
- } else if(lettura.equalsIgnoreCase("-1")) return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement