public static void main(String[] args) { String z = in.next(); int k = in.nextInt(); int s = in.nextInt() - 1; int l = in.nextInt(); int[] t = new int[l]; for (int i = 0; i < l; ++i) { t[i] = in.nextInt() - 1; } int[][] f = new int[z.length()][k]; for (int i = 0; i < k; ++i) { for (int j = 0; j < z.length(); ++j) { f[j][i] = in.nextInt() - 1; } } boolean[][] g = new boolean[z.length()][k]; for (int i = 0; i < k; ++i) { for (int j = 0; j < z.length(); ++j) { g[j][i] = (in.nextInt() == 0); } } DFA dfa = new DFA(z.toCharArray(), k, s, t, f, g); int n = in.nextInt(); out.println(dfa.count(n)); out.flush(); }
public static void main(String[] args) { long start = System.currentTimeMillis(); while (in.hasNext()) solve(); out.flush(); long end = System.currentTimeMillis(); // trace(end-start + "ms"); in.close(); out.close(); }
public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); // trace(end-start + "ms"); br.close(); out.close(); }
public static void main(String[] args) { debug = args.length > 0; long start = System.nanoTime(); solve(); out.flush(); long end = System.nanoTime(); dump((end - start) / 1000000 + " ms"); in.close(); out.close(); }
public static void main(String[] args) { debug = args.length > 0; long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); dump((end - start) + "ms"); in.close(); out.close(); }
public void save() throws Exception { // save out the RSA information PrintWriter fileout = new PrintWriter(new FileWriter(AUTHFILE)); fileout.flush(); fileout.println(p); fileout.println(q); fileout.println(n); fileout.println(phiN); // fileout.println(e); // fileout.println(d); fileout.println(S); fileout.println(V); fileout.close(); }
public static void main(String[] args) throws java.lang.Exception { // let_me_start String s = s(); String t = s(); int c[] = new int[150]; int d[] = new int[150]; String S = s.toUpperCase(); String T = t.toUpperCase(); int C[] = new int[150]; int D[] = new int[150]; int n = s.length(); int m = t.length(); // int arr[] = is((int)n); long ans = 0; for (int i = 1; i <= n; i++) { c[s.charAt(i - 1)]++; } for (int i = 1; i <= m; i++) { d[t.charAt(i - 1)]++; } for (int i = 1; i <= n; i++) { C[S.charAt(i - 1)]++; } for (int i = 1; i <= m; i++) { D[T.charAt(i - 1)]++; } int b = 0; int min = 1000000000; for (int i = 1; i <= 149; i++) { b += Math.min(c[i], d[i]); d[i] -= Math.min(c[i], d[i]); } int a = 0; min = 1000000000; for (int i = 1; i <= 149; i++) { a += Math.min(C[i], D[i]); D[i] -= Math.min(C[i], D[i]); } a = a - b; out.write("" + b + " " + a + "\n"); out.flush(); return; }
public static void main(String[] args) throws java.lang.Exception { // let_me_start /* BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br=new BufferedReader(new FileReader("input.txt")); BufferedWriter out=new BufferedWriter(new FileWriter("output.txt")); */ int n = i(); int m = i(); // int arr[] = is((int)n); // String ans = "NO"; long ans = 0; for (int i = 1; i <= n; i++) {} out.write("" + ans + "\n"); out.flush(); return; }