結果
| 問題 | No.239 にゃんぱすー |
| コンテスト | |
| ユーザー |
len_prog
|
| 提出日時 | 2016-06-15 11:56:07 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 125 ms / 2,000 ms |
| + 905µs | |
| コード長 | 969 bytes |
| 記録 | |
| コンパイル時間 | 1,588 ms |
| コンパイル使用メモリ | 85,992 KB |
| 実行使用メモリ | 48,436 KB |
| 最終ジャッジ日時 | 2026-09-12 17:13:15 |
| 合計ジャッジ時間 | 7,078 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
String[][] greetArr = new String[N][N];
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
greetArr[i][j] = scan.next();
}
}
boolean isFindRenchon = false;
boolean notNyanpassSay = false;
int renchonCount = 0;
int renchonDiscoverPos = -1;
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
if(greetArr[j][i].equals("-")){
//何もしない
}else if(greetArr[j][i].equals("nyanpass")){
if(!isFindRenchon){
renchonDiscoverPos = i;
}
}else{
notNyanpassSay = true;
}
}
if(!notNyanpassSay){
renchonCount++;
isFindRenchon = true;
}
notNyanpassSay = false;
}
if(renchonCount == 1 && isFindRenchon){
System.out.println(renchonDiscoverPos + 1);
}else{
System.out.println(-1);
}
scan.close();
}
}
len_prog