結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2015-07-10 23:16:58 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 1,287 bytes |
コンパイル時間 | 5,284 ms |
コンパイル使用メモリ | 78,624 KB |
実行使用メモリ | 51,852 KB |
最終ジャッジ日時 | 2024-07-08 02:16:50 |
合計ジャッジ時間 | 7,350 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class No239 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int N = Integer.parseInt(br.readLine()); String[][] a = new String[N][N]; for (int i = 0; i < N; i++) { a[i] = br.readLine().split(" "); } // にゃんパスカウンター int count[] = new int[N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (a[i][j].equals("nyanpass")) { count[j]++; } } } int num = -1; for (int i = 0; i < N; i++) { if (count[i] == N - 1) { if (num == -1) { num = i + 1; } else { num = -1; break; } } } System.out.println(num); } catch (Exception e) { e.printStackTrace(); System.err.println("Error:" + e.getMessage()); } } }