結果

問題 No.239 にゃんぱすー
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-14 13:24:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 71,308 KB
実行使用メモリ 60,440 KB
最終ジャッジ日時 2023-08-11 02:11:47
合計ジャッジ時間 8,717 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
56,104 KB
testcase_01 AC 117 ms
55,752 KB
testcase_02 AC 110 ms
56,028 KB
testcase_03 AC 110 ms
56,404 KB
testcase_04 AC 107 ms
55,800 KB
testcase_05 AC 107 ms
54,028 KB
testcase_06 AC 110 ms
56,060 KB
testcase_07 AC 113 ms
55,800 KB
testcase_08 AC 115 ms
55,836 KB
testcase_09 AC 124 ms
55,616 KB
testcase_10 AC 138 ms
56,052 KB
testcase_11 AC 146 ms
56,700 KB
testcase_12 AC 153 ms
56,444 KB
testcase_13 AC 154 ms
56,080 KB
testcase_14 AC 155 ms
56,972 KB
testcase_15 AC 160 ms
56,516 KB
testcase_16 AC 161 ms
57,052 KB
testcase_17 AC 164 ms
58,584 KB
testcase_18 AC 173 ms
58,648 KB
testcase_19 AC 172 ms
58,716 KB
testcase_20 AC 176 ms
57,296 KB
testcase_21 AC 178 ms
58,892 KB
testcase_22 AC 183 ms
59,416 KB
testcase_23 AC 189 ms
59,200 KB
testcase_24 AC 190 ms
59,280 KB
testcase_25 AC 192 ms
59,508 KB
testcase_26 AC 204 ms
60,312 KB
testcase_27 AC 114 ms
56,056 KB
testcase_28 AC 131 ms
56,124 KB
testcase_29 AC 149 ms
56,548 KB
testcase_30 AC 156 ms
56,668 KB
testcase_31 AC 153 ms
56,660 KB
testcase_32 AC 159 ms
58,452 KB
testcase_33 AC 181 ms
58,400 KB
testcase_34 AC 179 ms
58,848 KB
testcase_35 AC 194 ms
59,736 KB
testcase_36 AC 197 ms
60,440 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