import java.util.ArrayList; import java.util.Scanner; class tstudent { String name; String sno; char sex; }; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); ArrayListarr=new ArrayList(); tstudent t; int n=sc.nextInt(); for (int i = 0; i < n; i++) { t=new tstudent(); t.name=sc.next(); t.sno=sc.next(); t.sex=sc.next().charAt(0); arr.add(t); } n=sc.nextInt(); for (int i = 0; i < n; i++) { String a=sc.next(); String b=sc.next(); char asex=' ',bsex=' '; for (int j = 0; j < arr.size(); j++) { if(arr.get(j).name.equals(a)||arr.get(j).sno.equals(a)) asex=arr.get(j).sex; if(arr.get(j).name.equals(b)||arr.get(j).sno.equals(b)) bsex=arr.get(j).sex; if(asex!=' '&&bsex!=' ')break; } if(asex==bsex)System.out.println("N"); else System.out.println("Y"); } } }
0.0分
3 人评分
WU-格式化数据输出 (C++代码)浏览:1194 |
C语言程序设计教程(第三版)课后习题6.6 (C++代码)浏览:627 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:685 |
C二级辅导-进制转换 (C语言代码)浏览:660 |
IP判断 (C语言代码)浏览:533 |
判定字符位置 (C语言代码)浏览:792 |
分解质因数 (C++代码)浏览:1471 |
1199题解浏览:653 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:446 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:439 |