結果

問題 No.239 にゃんぱすー
ユーザー yagi2yagi2
提出日時 2017-04-20 16:36:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 1,067 bytes
コンパイル時間 2,638 ms
コンパイル使用メモリ 82,084 KB
実行使用メモリ 59,972 KB
最終ジャッジ日時 2023-09-27 03:45:37
合計ジャッジ時間 11,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,004 KB
testcase_01 AC 116 ms
55,848 KB
testcase_02 AC 122 ms
55,792 KB
testcase_03 AC 123 ms
56,128 KB
testcase_04 AC 120 ms
56,064 KB
testcase_05 AC 123 ms
55,792 KB
testcase_06 AC 117 ms
55,712 KB
testcase_07 AC 120 ms
56,140 KB
testcase_08 AC 127 ms
55,508 KB
testcase_09 AC 133 ms
55,928 KB
testcase_10 AC 162 ms
56,312 KB
testcase_11 AC 166 ms
56,552 KB
testcase_12 AC 170 ms
54,440 KB
testcase_13 AC 166 ms
56,284 KB
testcase_14 AC 175 ms
56,268 KB
testcase_15 AC 174 ms
56,316 KB
testcase_16 AC 179 ms
56,044 KB
testcase_17 AC 185 ms
58,604 KB
testcase_18 AC 188 ms
58,820 KB
testcase_19 AC 199 ms
58,780 KB
testcase_20 AC 192 ms
58,896 KB
testcase_21 AC 200 ms
59,236 KB
testcase_22 AC 200 ms
58,692 KB
testcase_23 AC 203 ms
59,388 KB
testcase_24 AC 207 ms
59,516 KB
testcase_25 AC 215 ms
59,800 KB
testcase_26 AC 219 ms
59,724 KB
testcase_27 AC 124 ms
55,788 KB
testcase_28 AC 152 ms
58,616 KB
testcase_29 AC 170 ms
56,900 KB
testcase_30 AC 170 ms
55,972 KB
testcase_31 AC 174 ms
56,004 KB
testcase_32 AC 189 ms
59,052 KB
testcase_33 AC 199 ms
58,752 KB
testcase_34 AC 196 ms
58,752 KB
testcase_35 AC 214 ms
59,812 KB
testcase_36 AC 214 ms
59,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        Map<Integer, Integer> renchon = new HashMap<>();

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                String s = sc.next();
                if (s.equals("nyanpass")) {
                    if (!renchon.containsKey(j)) {
                        renchon.put(j, 0);
                    }
                    renchon.put(j, renchon.get(j)+1);
                }
            }
        }

        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (!renchon.containsKey(i)) continue;
            if (renchon.get(i) == N - 1) cnt++;
        }

        if (cnt != 1) {
            System.out.println("-1");
        } else {
            renchon.forEach((integer, integer2) -> {
                if (integer2 == N -1) System.out.println(integer+1);
            });
        }
    }
}
0