結果

問題 No.239 にゃんぱすー
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-04-17 22:44:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 963 bytes
コンパイル時間 4,503 ms
コンパイル使用メモリ 70,952 KB
実行使用メモリ 59,868 KB
最終ジャッジ日時 2023-09-09 11:09:44
合計ジャッジ時間 12,021 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,728 KB
testcase_01 AC 118 ms
55,760 KB
testcase_02 AC 119 ms
56,004 KB
testcase_03 AC 119 ms
55,856 KB
testcase_04 AC 118 ms
55,696 KB
testcase_05 AC 119 ms
56,436 KB
testcase_06 AC 118 ms
55,968 KB
testcase_07 AC 123 ms
56,000 KB
testcase_08 AC 123 ms
55,668 KB
testcase_09 AC 132 ms
55,872 KB
testcase_10 AC 162 ms
56,912 KB
testcase_11 AC 165 ms
56,616 KB
testcase_12 AC 163 ms
56,004 KB
testcase_13 AC 158 ms
56,128 KB
testcase_14 AC 174 ms
56,812 KB
testcase_15 AC 170 ms
55,980 KB
testcase_16 AC 173 ms
56,244 KB
testcase_17 AC 177 ms
58,436 KB
testcase_18 AC 182 ms
58,472 KB
testcase_19 AC 187 ms
58,504 KB
testcase_20 AC 189 ms
58,224 KB
testcase_21 AC 193 ms
58,144 KB
testcase_22 AC 199 ms
58,428 KB
testcase_23 AC 204 ms
58,832 KB
testcase_24 AC 212 ms
59,776 KB
testcase_25 AC 212 ms
59,440 KB
testcase_26 AC 219 ms
59,648 KB
testcase_27 AC 125 ms
56,072 KB
testcase_28 AC 156 ms
54,424 KB
testcase_29 AC 168 ms
56,420 KB
testcase_30 AC 174 ms
56,100 KB
testcase_31 AC 176 ms
56,240 KB
testcase_32 AC 185 ms
58,120 KB
testcase_33 AC 191 ms
58,300 KB
testcase_34 AC 199 ms
59,052 KB
testcase_35 AC 208 ms
59,624 KB
testcase_36 AC 217 ms
59,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        String[][] a = new String[n][n];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                a[i][j] = in.next();
            }
        }

        String target = "nyanpass";
        int ans = 0;
        int count = 0;

        for(int j = 0; j < n; j++) {
            boolean flag = true;
            for(int i = 0; i < n; i++) {
                if(a[i][j].equals(target))
                    continue;
                else if(a[i][j].equals("-"))
                    continue;
                else
                    flag = false;
            }
            if(flag) {
                ans = j + 1;
                count++;
            }
        }

        if(count == 1)
            System.out.println(ans);
        else
            System.out.println(-1);
    }
}
0