結果

問題 No.547 未知の言語
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-12 23:03:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 861 bytes
コンパイル時間 3,261 ms
コンパイル使用メモリ 71,872 KB
実行使用メモリ 49,852 KB
最終ジャッジ日時 2023-09-08 09:46:57
合計ジャッジ時間 4,486 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,360 KB
testcase_01 AC 41 ms
49,048 KB
testcase_02 AC 42 ms
49,636 KB
testcase_03 AC 42 ms
49,108 KB
testcase_04 AC 42 ms
49,504 KB
testcase_05 AC 43 ms
49,668 KB
testcase_06 AC 43 ms
49,844 KB
testcase_07 AC 42 ms
49,344 KB
testcase_08 AC 42 ms
49,104 KB
testcase_09 AC 43 ms
49,852 KB
testcase_10 AC 42 ms
49,112 KB
testcase_11 AC 41 ms
49,332 KB
testcase_12 AC 43 ms
49,612 KB
testcase_13 AC 42 ms
49,400 KB
testcase_14 AC 42 ms
49,332 KB
testcase_15 AC 41 ms
49,300 KB
testcase_16 AC 41 ms
49,368 KB
testcase_17 AC 43 ms
49,348 KB
testcase_18 AC 42 ms
49,756 KB
testcase_19 AC 41 ms
49,104 KB
testcase_20 AC 42 ms
49,264 KB
testcase_21 AC 43 ms
47,400 KB
testcase_22 AC 43 ms
49,500 KB
testcase_23 AC 42 ms
49,576 KB
testcase_24 AC 42 ms
49,160 KB
testcase_25 AC 42 ms
49,240 KB
testcase_26 AC 42 ms
49,152 KB
testcase_27 AC 41 ms
49,844 KB
testcase_28 AC 42 ms
49,184 KB
testcase_29 AC 41 ms
49,408 KB
testcase_30 AC 42 ms
49,440 KB
testcase_31 AC 42 ms
49,300 KB
testcase_32 AC 42 ms
49,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;

class Program{

    public static void main(String[] args) {
        
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            int n = Integer.parseInt(br.readLine());
            String[] str1 = br.readLine().split(" ");
            String[] str2 = br.readLine().split(" ");
             System.out.println(diffNum(n,str1,str2)+1);
             System.out.println(str1[diffNum(n,str1,str2)]);
             System.out.println(str2[diffNum(n,str1,str2)]);           
        }catch(IOException e){
            e.getStackTrace();
        }
    }
    
    public static int diffNum(int n, String[] s1, String[] s2){
        int ans = 0;
        for(int i=0; i < n; i++){
            if(s1[i].equals(s2[i]))
                ans++;
            else break;
        }
        return ans;
    }
}
0