本人刚学习不久,只会一些基础的东西,希望别弄特别深奥的东西,我怕看不懂
后面有代码和PTA上的运行结果截图。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt(),i;
StringBuilder[] num1 = new StringBuilder[N];
int [] num2 = new int[N],num3 = new int[N];
for (i = 0; i < N; i++) {
num1[i] = new StringBuilder(sc.next());
num2[i] = sc.nextInt();
num3[i] = sc.nextInt();
}
int M = sc.nextInt();
int[] cxnum2 = new int[M];
for (i = 0; i < M; i++) {
cxnum2[i] = sc.nextInt();
for (int j = 0; j < N; j++) {
if (cxnum2[i] == num2[j]) {
System.out.println(num1[j] + " " + num3[j]);
}
}
}
}
}