結果

問題 No.1183 コイン遊び
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-16 17:22:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 3,502 ms
コンパイル使用メモリ 79,404 KB
実行使用メモリ 78,936 KB
最終ジャッジ日時 2024-04-25 15:37:00
合計ジャッジ時間 61,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 130 ms
54,056 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
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 AC 1,667 ms
75,956 KB
testcase_22 AC 1,686 ms
75,392 KB
testcase_23 WA -
testcase_24 AC 1,752 ms
75,648 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 AC 1,710 ms
76,140 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
権限があれば一括ダウンロードができます

ソースコード

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;
	            				System.out.println(i + " " + j + " " + count);
	            				break;
	            			}
	            			if (j == n-1) {
	            				count ++;
	            				i = j ;
	            				System.out.println(i + " " + j + " " + count);
	            				break;
	            			}
	            		}
	            	}

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