結果

問題 No.239 にゃんぱすー
ユーザー len_proglen_prog
提出日時 2016-06-15 11:56:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 969 bytes
コンパイル時間 2,374 ms
コンパイル使用メモリ 77,504 KB
実行使用メモリ 46,888 KB
最終ジャッジ日時 2024-04-17 22:37:21
合計ジャッジ時間 9,053 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
41,060 KB
testcase_01 AC 101 ms
41,264 KB
testcase_02 AC 116 ms
41,400 KB
testcase_03 AC 115 ms
41,548 KB
testcase_04 AC 112 ms
41,648 KB
testcase_05 AC 115 ms
41,228 KB
testcase_06 AC 105 ms
41,648 KB
testcase_07 AC 117 ms
41,840 KB
testcase_08 AC 118 ms
41,744 KB
testcase_09 AC 124 ms
41,992 KB
testcase_10 AC 129 ms
41,808 KB
testcase_11 AC 156 ms
41,628 KB
testcase_12 AC 159 ms
41,740 KB
testcase_13 AC 157 ms
42,072 KB
testcase_14 AC 162 ms
42,256 KB
testcase_15 AC 169 ms
42,412 KB
testcase_16 AC 169 ms
42,396 KB
testcase_17 AC 160 ms
43,044 KB
testcase_18 AC 152 ms
43,392 KB
testcase_19 AC 179 ms
43,320 KB
testcase_20 AC 198 ms
43,588 KB
testcase_21 AC 188 ms
44,336 KB
testcase_22 AC 192 ms
44,464 KB
testcase_23 AC 190 ms
44,820 KB
testcase_24 AC 206 ms
46,592 KB
testcase_25 AC 212 ms
45,900 KB
testcase_26 AC 220 ms
46,656 KB
testcase_27 AC 122 ms
41,468 KB
testcase_28 AC 142 ms
41,768 KB
testcase_29 AC 149 ms
42,088 KB
testcase_30 AC 168 ms
42,308 KB
testcase_31 AC 171 ms
42,416 KB
testcase_32 AC 185 ms
42,996 KB
testcase_33 AC 178 ms
43,524 KB
testcase_34 AC 191 ms
45,564 KB
testcase_35 AC 218 ms
46,772 KB
testcase_36 AC 225 ms
46,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
	}

}
0