結果
| 問題 |
No.1183 コイン遊び
|
| コンテスト | |
| ユーザー |
Apass
|
| 提出日時 | 2020-08-22 13:24:01 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 507 ms / 2,000 ms |
| コード長 | 1,045 bytes |
| コンパイル時間 | 3,345 ms |
| コンパイル使用メモリ | 74,692 KB |
| 実行使用メモリ | 80,020 KB |
| 最終ジャッジ日時 | 2024-10-15 07:38:46 |
| 合計ジャッジ時間 | 17,105 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
import java.io.*;
import java.util.*;
public class B_CoinPlay {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st;
private static int readInt() throws IOException {
while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
return Integer.parseInt(st.nextToken());
}
private static int[] readIntArray(final int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i]= readInt();
return a;
}
public static void main(String[] args) throws IOException {
int N = readInt();
int[] A = readIntArray(N);
int[] B = readIntArray(N);
int count = 0;
boolean theSame = true;
for (int i = 0; i < N; i++) {
if (A[i] == B[i]) theSame = true;
else {
if (theSame) count ++;
theSame = false;
}
}
System.out.println(count);
}
}
Apass