結果

問題 No.1183 コイン遊び
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-16 17:23:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,581 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 3,247 ms
コンパイル使用メモリ 74,752 KB
実行使用メモリ 76,052 KB
最終ジャッジ日時 2024-04-25 15:38:24
合計ジャッジ時間 41,822 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
52,912 KB
testcase_01 AC 112 ms
54,344 KB
testcase_02 AC 109 ms
52,888 KB
testcase_03 AC 121 ms
54,108 KB
testcase_04 AC 122 ms
54,388 KB
testcase_05 AC 125 ms
54,236 KB
testcase_06 AC 120 ms
54,036 KB
testcase_07 AC 121 ms
53,808 KB
testcase_08 AC 164 ms
56,820 KB
testcase_09 AC 174 ms
56,192 KB
testcase_10 AC 337 ms
59,240 KB
testcase_11 AC 514 ms
59,228 KB
testcase_12 AC 1,222 ms
73,760 KB
testcase_13 AC 1,119 ms
73,284 KB
testcase_14 AC 1,483 ms
75,636 KB
testcase_15 AC 1,502 ms
75,720 KB
testcase_16 AC 1,550 ms
76,052 KB
testcase_17 AC 1,520 ms
76,016 KB
testcase_18 AC 1,480 ms
75,936 KB
testcase_19 AC 1,545 ms
75,652 KB
testcase_20 AC 1,548 ms
75,584 KB
testcase_21 AC 1,581 ms
76,036 KB
testcase_22 AC 1,551 ms
76,036 KB
testcase_23 AC 1,552 ms
75,912 KB
testcase_24 AC 1,520 ms
75,744 KB
testcase_25 AC 1,536 ms
75,684 KB
testcase_26 AC 1,530 ms
75,848 KB
testcase_27 AC 1,527 ms
75,844 KB
testcase_28 AC 1,510 ms
75,720 KB
testcase_29 AC 1,491 ms
75,556 KB
testcase_30 AC 1,509 ms
75,752 KB
testcase_31 AC 1,523 ms
75,820 KB
testcase_32 AC 1,527 ms
75,856 KB
testcase_33 AC 1,541 ms
75,952 KB
testcase_34 AC 1,503 ms
75,760 KB
権限があれば一括ダウンロードができます

ソースコード

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 ++;
	            				i = j ;
	            				break;
	            			}
	            		}
	            	}

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