結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2016-06-15 11:56:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 969 bytes |
コンパイル時間 | 2,178 ms |
コンパイル使用メモリ | 77,292 KB |
実行使用メモリ | 46,504 KB |
最終ジャッジ日時 | 2024-10-09 16:20:37 |
合計ジャッジ時間 | 10,172 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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(); } }