結果
| 問題 | 
                            No.1183 コイン遊び
                             | 
                    
| コンテスト | |
| ユーザー | 
                             xRS43BofaUEZ5gc
                         | 
                    
| 提出日時 | 2021-03-16 17:23:53 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,772 ms / 2,000 ms | 
| コード長 | 983 bytes | 
| コンパイル時間 | 3,347 ms | 
| コンパイル使用メモリ | 75,092 KB | 
| 実行使用メモリ | 66,024 KB | 
| 最終ジャッジ日時 | 2024-11-08 02:42:58 | 
| 合計ジャッジ時間 | 46,125 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
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 ++;
	            				i = j ;
	            				break;
	            			}
	            		}
	            	}
	            }
	            System.out.println(count);
}}
            
            
            
        
            
xRS43BofaUEZ5gc