結果
問題 | No.547 未知の言語 |
ユーザー |
|
提出日時 | 2017-10-12 23:03:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 861 bytes |
コンパイル時間 | 2,217 ms |
コンパイル使用メモリ | 75,212 KB |
実行使用メモリ | 50,420 KB |
最終ジャッジ日時 | 2024-06-26 02:50:04 |
合計ジャッジ時間 | 5,409 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
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; } }