結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2018-01-20 18:09:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 780 bytes |
コンパイル時間 | 3,942 ms |
コンパイル使用メモリ | 73,844 KB |
実行使用メモリ | 39,396 KB |
最終ジャッジ日時 | 2024-12-25 03:20:07 |
合計ジャッジ時間 | 8,323 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
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());int[] greet = new int[N];int ans = -1;int cnt = 0;for (int i = 0; i < N; i++) {String[] str = br.readLine().split(" ");for (int j = 0; j < N; j++) {if (str[j].equals("nyanpass")) {greet[j]++;}}}for (int i = 0; i < greet.length; i++) {if (greet[i] == N - 1) {ans = i + 1;cnt++;}}System.out.println(cnt == 1 ? ans : -1);} catch (IOException e) {e.printStackTrace();}}}