結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
|
提出日時 | 2018-01-20 17:46:41 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 898 bytes |
コンパイル時間 | 3,981 ms |
コンパイル使用メモリ | 76,160 KB |
実行使用メモリ | 39,664 KB |
最終ジャッジ日時 | 2024-12-25 03:17:12 |
合計ジャッジ時間 | 7,464 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 WA * 2 |
ソースコード
package me.yukicoder.lv1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0239 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { int N = Integer.parseInt(br.readLine()); String[][] greet = new String[N][N]; int ans = -1; for (int i = 0; i < N; i++) { String[] str = br.readLine().split(" "); for (int j = 0; j < N; j++) { greet[i][j] = str[j]; } } for (int j = 0; j < N; j++) { int cnt = 0; for (int i = 0; i < N; i++) { if (i != j) { cnt = greet[i][j].equals("nyanpass") ? cnt + 1 : cnt; } } if (cnt == N - 1) { if (ans == -1) { ans = j + 1; } else { ans = -1; } } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } }