結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2021-03-07 22:12:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 3,824 ms |
コンパイル使用メモリ | 74,456 KB |
実行使用メモリ | 51,912 KB |
最終ジャッジ日時 | 2024-10-09 05:59:26 |
合計ジャッジ時間 | 7,608 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000239_Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] cntArr = new int[n]; for(int i = 0; i < n; i++) { String[] greetings = br.readLine().split(" "); for(int j = 0; j < n; j++) { if("nyanpass".equals(greetings[j])) cntArr[j] += 1; } } int result = -1; for(int k = 0; k < n; k++) { if(cntArr[k] == n - 1) { if(result == -1) { result = k + 1; } else { result = -1; break; } } } System.out.println(result); } }