結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
53,800 KB
testcase_01 AC 133 ms
53,984 KB
testcase_02 AC 136 ms
53,832 KB
testcase_03 AC 138 ms
53,976 KB
testcase_04 AC 130 ms
53,752 KB
testcase_05 AC 132 ms
54,500 KB
testcase_06 AC 132 ms
53,784 KB
testcase_07 AC 135 ms
53,964 KB
testcase_08 AC 141 ms
53,904 KB
testcase_09 AC 152 ms
54,084 KB
testcase_10 AC 163 ms
53,788 KB
testcase_11 AC 176 ms
54,288 KB
testcase_12 AC 178 ms
54,364 KB
testcase_13 AC 182 ms
53,916 KB
testcase_14 AC 186 ms
54,136 KB
testcase_15 AC 191 ms
54,288 KB
testcase_16 AC 189 ms
54,260 KB
testcase_17 AC 199 ms
54,236 KB
testcase_18 AC 197 ms
55,972 KB
testcase_19 AC 203 ms
56,512 KB
testcase_20 AC 200 ms
56,776 KB
testcase_21 AC 211 ms
56,948 KB
testcase_22 AC 207 ms
56,732 KB
testcase_23 AC 238 ms
56,320 KB
testcase_24 AC 228 ms
57,572 KB
testcase_25 AC 230 ms
57,716 KB
testcase_26 AC 234 ms
58,084 KB
testcase_27 AC 139 ms
54,064 KB
testcase_28 AC 161 ms
54,228 KB
testcase_29 AC 180 ms
54,060 KB
testcase_30 AC 184 ms
54,392 KB
testcase_31 AC 185 ms
54,564 KB
testcase_32 AC 197 ms
56,324 KB
testcase_33 AC 207 ms
56,684 KB
testcase_34 AC 213 ms
56,772 KB
testcase_35 AC 219 ms
57,176 KB
testcase_36 AC 232 ms
58,292 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 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);
		}
 	}
}
0