考察理解题目的能力, 上代码:
import java.io.BufferedReader;import java.io.InputStreamReader;public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num = Integer.parseInt(br.readLine()); int oneNum = 0; int zeroNum = 0; String[][] str = new String[num][2]; if (num >= 2 && num <= 50) { for(int i=0; i0; j--) { if(!str[i][0].equals(str[j][0]) && !str[i][0].equals("-1") && !str[j][0].equals("-1")) { System.out.println(str[i][1] + " " + str[j][1]); str[i][0] = "-1"; str[j][0] = "-1"; break; } } } } else { return; } } else { return; } }}