結果

問題 No.1183 コイン遊び
ユーザー RISE70226821
提出日時 2020-08-31 14:52:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,894 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 2,360 ms
コンパイル使用メモリ 75,228 KB
実行使用メモリ 66,040 KB
最終ジャッジ日時 2024-11-15 23:28:26
合計ジャッジ時間 44,108 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		for(int i = 0; i < N; i++){
			A[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++){
			B[i] = sc.nextInt();
		}
		
		// カウント
		int count = 0;
		if(A[0] != B[0]){
			count++;
		}
		for(int i = 0; i < N-1; i++){
			if(A[i] == B[i] && A[i+1] != B[i+1]){
				count++;
			}
		}
		
		
		// 出力
		System.out.println(count);
	}
}
0