赞
踩
- 8
- 0 Amy
- 1 Tom
- 1 Bill
- 0 Cindy
- 0 Maya
- 1 John
- 1 Jack
- 0 Linda
- Amy Jack
- Tom Linda
- Bill Maya
- Cindy John
-
-
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
-
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- int n = Integer.parseInt(br.readLine());
- String[][] strings = new String[n][3];
- for(int i=0;i<n;i++) {
- String[] line = br.readLine().split(" ");
- strings[i][0]=line[0];
- strings[i][1]=line[1];
- strings[i][2]="true";
- }
- for(int i=0;i<n;i++) {
- for(int j=n-1;j>0;j--) {
- if(!strings[i][0].equals(strings[j][0])) {
- if(strings[i][2].equals("true")&&strings[j][2].equals("true")) {
- strings[i][2]="false";
- strings[j][2]="false";
- System.out.println(strings[i][1]+" "+ strings[j][1]);
- break;
- }
-
- }
- }
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。