結果

問題 No.239 にゃんぱすー
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-14 13:32:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 74,068 KB
実行使用メモリ 47,012 KB
最終ジャッジ日時 2024-04-28 19:22:16
合計ジャッジ時間 10,293 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,344 KB
testcase_01 AC 140 ms
41,640 KB
testcase_02 AC 138 ms
41,432 KB
testcase_03 AC 144 ms
41,500 KB
testcase_04 AC 142 ms
41,684 KB
testcase_05 AC 138 ms
41,424 KB
testcase_06 AC 139 ms
41,304 KB
testcase_07 AC 145 ms
41,264 KB
testcase_08 AC 145 ms
41,804 KB
testcase_09 AC 149 ms
41,364 KB
testcase_10 AC 161 ms
41,600 KB
testcase_11 AC 180 ms
42,436 KB
testcase_12 AC 186 ms
42,060 KB
testcase_13 AC 185 ms
42,540 KB
testcase_14 AC 198 ms
42,120 KB
testcase_15 AC 194 ms
42,100 KB
testcase_16 AC 195 ms
42,964 KB
testcase_17 AC 209 ms
42,848 KB
testcase_18 AC 206 ms
43,180 KB
testcase_19 AC 222 ms
43,144 KB
testcase_20 AC 212 ms
44,052 KB
testcase_21 AC 216 ms
44,168 KB
testcase_22 AC 217 ms
44,372 KB
testcase_23 AC 225 ms
45,248 KB
testcase_24 AC 232 ms
45,804 KB
testcase_25 AC 235 ms
46,584 KB
testcase_26 AC 239 ms
46,572 KB
testcase_27 AC 147 ms
41,648 KB
testcase_28 AC 177 ms
41,728 KB
testcase_29 AC 185 ms
41,600 KB
testcase_30 AC 194 ms
42,256 KB
testcase_31 AC 199 ms
43,192 KB
testcase_32 AC 207 ms
43,216 KB
testcase_33 AC 213 ms
43,508 KB
testcase_34 AC 219 ms
44,068 KB
testcase_35 AC 236 ms
45,816 KB
testcase_36 AC 239 ms
47,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 cnt2 = 0;
			for(int j = 0 ; j < n ; j++) {
				if(a[j][i].equals("nyanpass")) {
					cnt2++;
					if(cnt2 == n - 1) {
						cnt1++;
						ret = i + 1;
					}
				}
			}
		}
		if(cnt1 == 1) {
			System.out.println(ret);
		} else {
			System.out.println(-1);
		}
 	}
}
0