编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#116303 #1468. [L1-6] Nutrimatic Compile Error 0 0 ms 0 K Java / 948 B chen 2025-04-09 16:34:17
显示原始代码
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();

        sc.nextLine();
        for (int i = 0; i < T; i++) {
            boolean flag = true;
            String s = sc.nextLine();
            String t = sc.nextLine();

            int sidx = 0;
            int pidx = 0;
            for (; sidx < s.length(); sidx++) {
                if (s.charAt(sidx) == t.charAt(pidx)) {
                    pidx++;
                    continue;
                } else if (t.charAt(pidx) == '[') {
                    int tem = pidx;
                    while (t.charAt(++tem) != ']') {
                    }
                    String pattern = t.substring(pidx, tem);
                    if (pattern.indexOf(s.charAt(j)) == -1) {
                        flag = false;
                        break;
                    } else {
                        pidx = tem + 1;
                    }
                } else {
                    flag = false;
                    break;
                }
            }

            if (flag && sidx == s.length() && pidx == t.length()) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}

编译信息

Can't open /dev/null: No such file or directory
Main.java:24: error: cannot find symbol
					if (pattern.indexOf(s.charAt(j)) == -1) {
					                             ^
  symbol:   variable j
  location: class Main
1 error