結果
| 問題 | No.239 にゃんぱすー |
| コンテスト | |
| ユーザー |
ohagi_1182
|
| 提出日時 | 2017-10-14 13:24:19 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 631 bytes |
| 記録 | |
| コンパイル時間 | 1,679 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 47,320 KB |
| 最終ジャッジ日時 | 2026-05-12 10:05:17 |
| 合計ジャッジ時間 | 6,449 ms |
|
ジャッジサーバーID (参考情報) |
tmp-judge_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[][] a = new String[n][n];
for(int i = 0 ; i < n ; i++) {
for(int j = 0 ; j < n ; j++) {
a[i][j] = sc.next();
}
}
int ret = 0; int cnt1 = 0;
for(int i = 0 ; i < n ; i++) {
int cnt = 0;
for(int j = 0 ; j < n ; j++) {
if(a[j][i].equals("nyanpass")) {
cnt++;
}
if(cnt == n - 1) {
cnt1++;
ret = i + 1;
break;
}
}
}
if(cnt1 == 1) {
System.out.println(ret);
} else {
System.out.println(-1);
}
}
}
ohagi_1182