結果

問題 No.1183 コイン遊び
ユーザー xRS43BofaUEZ5gc
提出日時 2021-03-16 17:22:13
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 3,823 ms
コンパイル使用メモリ 78,764 KB
実行使用メモリ 78,392 KB
最終ジャッジ日時 2024-11-08 02:41:26
合計ジャッジ時間 21,275 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 5 WA * 11 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

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