結果

問題 No.1183 コイン遊び
ユーザー ApassApass
提出日時 2020-08-22 13:24:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 549 ms / 2,000 ms
コード長 1,045 bytes
コンパイル時間 3,933 ms
コンパイル使用メモリ 75,292 KB
実行使用メモリ 80,212 KB
最終ジャッジ日時 2024-04-23 07:50:14
合計ジャッジ時間 19,703 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
50,392 KB
testcase_01 AC 57 ms
50,352 KB
testcase_02 AC 63 ms
50,212 KB
testcase_03 AC 59 ms
50,056 KB
testcase_04 AC 64 ms
50,024 KB
testcase_05 AC 59 ms
50,040 KB
testcase_06 AC 57 ms
50,152 KB
testcase_07 AC 60 ms
50,480 KB
testcase_08 AC 67 ms
50,540 KB
testcase_09 AC 68 ms
50,948 KB
testcase_10 AC 140 ms
54,236 KB
testcase_11 AC 191 ms
56,340 KB
testcase_12 AC 479 ms
68,904 KB
testcase_13 AC 461 ms
66,828 KB
testcase_14 AC 525 ms
73,676 KB
testcase_15 AC 538 ms
76,776 KB
testcase_16 AC 539 ms
80,032 KB
testcase_17 AC 542 ms
79,940 KB
testcase_18 AC 525 ms
79,844 KB
testcase_19 AC 514 ms
80,008 KB
testcase_20 AC 541 ms
80,168 KB
testcase_21 AC 531 ms
79,856 KB
testcase_22 AC 481 ms
80,020 KB
testcase_23 AC 532 ms
80,040 KB
testcase_24 AC 549 ms
79,800 KB
testcase_25 AC 537 ms
80,060 KB
testcase_26 AC 502 ms
79,964 KB
testcase_27 AC 536 ms
80,152 KB
testcase_28 AC 495 ms
80,140 KB
testcase_29 AC 527 ms
80,020 KB
testcase_30 AC 543 ms
79,824 KB
testcase_31 AC 491 ms
79,832 KB
testcase_32 AC 527 ms
79,976 KB
testcase_33 AC 529 ms
80,212 KB
testcase_34 AC 537 ms
76,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class B_CoinPlay {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    private static int[] readIntArray(final int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i]= readInt();
        return a;
    }

    public static void main(String[] args) throws IOException {
        int N = readInt();
        int[] A = readIntArray(N);
        int[] B = readIntArray(N);

        int count = 0;
        boolean theSame = true;
        for (int i = 0; i < N; i++) {
            if (A[i] == B[i]) theSame = true;
            else {
                if (theSame) count ++;
                theSame = false;
            }
        }

        System.out.println(count);
    }
}
0