結果

問題 No.1183 コイン遊び
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-16 16:32:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 3,259 ms
コンパイル使用メモリ 77,568 KB
実行使用メモリ 83,088 KB
最終ジャッジ日時 2024-04-25 15:08:44
合計ジャッジ時間 28,095 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
61,056 KB
testcase_01 AC 130 ms
54,388 KB
testcase_02 WA -
testcase_03 AC 128 ms
54,000 KB
testcase_04 AC 114 ms
53,060 KB
testcase_05 AC 112 ms
52,928 KB
testcase_06 AC 117 ms
53,168 KB
testcase_07 AC 129 ms
53,992 KB
testcase_08 AC 191 ms
56,600 KB
testcase_09 AC 193 ms
56,620 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,368 ms
73,640 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1,699 ms
75,624 KB
testcase_16 AC 1,657 ms
75,884 KB
testcase_17 AC 1,654 ms
75,936 KB
testcase_18 AC 1,659 ms
75,836 KB
testcase_19 AC 1,629 ms
75,752 KB
testcase_20 AC 1,730 ms
75,360 KB
testcase_21 AC 1,659 ms
75,852 KB
testcase_22 AC 1,656 ms
76,032 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {
	    		Scanner sc = new Scanner(System.in);
	            int n = sc.nextInt();
	            int[] ai = new int[n];
	            int[] bi = new int[n];
	            for (int i = 0; i < n; i++) {
	            	ai[i] = sc.nextInt();
	            }
	            for (int i =0; i < n; i++) {
	            	bi[i]=sc.nextInt();
	            }
	            sc.close();

	            int count = 0;

	            for (int i = 0; i < n; i ++) {
	            	if (ai[i] != bi[i]) {
	            		for (int j = i; j < n; j ++) {
	            			if (ai[j] == bi[j]) {
	            				count ++;
	            				i = j;
	            				break;
	            			}
	            			if (j == n-1) {
	            				count ++;
	            				break;
	            			}
	            		}
	            	}

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