結果

問題 No.1183 コイン遊び
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-16 16:27:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 956 bytes
コンパイル時間 3,213 ms
コンパイル使用メモリ 74,884 KB
実行使用メモリ 83,780 KB
最終ジャッジ日時 2024-04-25 15:06:06
合計ジャッジ時間 33,564 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 131 ms
53,884 KB
testcase_04 AC 128 ms
54,004 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 WA -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
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