触宝第一题,那个判断子串的(java版)
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = Integer.parseInt(sc.nextLine());
String[] arr = new String[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextLine();
}
int m = Integer.parseInt(sc.nextLine());
for (int i = 0; i < m; i++) {
String str = sc.nextLine();
int count = 0;
for (int j = 0; j < n; j++) {
if (arr[j].contains(str)) {
++count;
}
}
System.out.println(count);
}
}
}
} 提交就AC,不知道为啥 至于第二题,强烈怀疑题有问题。我怎么看都是31.83 接受反驳,希望我错了~
#Java工程师#