結果

問題 No.239 にゃんぱすー
ユーザー samplelpmassamplelpmas
提出日時 2016-12-11 18:05:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 1,036 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 71,776 KB
実行使用メモリ 59,852 KB
最終ジャッジ日時 2023-08-19 11:23:44
合計ジャッジ時間 9,470 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,752 KB
testcase_01 AC 109 ms
56,340 KB
testcase_02 AC 107 ms
54,144 KB
testcase_03 AC 111 ms
55,992 KB
testcase_04 AC 111 ms
58,080 KB
testcase_05 AC 107 ms
56,060 KB
testcase_06 AC 108 ms
55,756 KB
testcase_07 AC 109 ms
55,732 KB
testcase_08 AC 113 ms
55,952 KB
testcase_09 AC 116 ms
55,616 KB
testcase_10 AC 143 ms
56,492 KB
testcase_11 AC 144 ms
56,512 KB
testcase_12 AC 153 ms
56,116 KB
testcase_13 AC 154 ms
56,176 KB
testcase_14 AC 171 ms
56,052 KB
testcase_15 AC 166 ms
56,160 KB
testcase_16 AC 162 ms
56,124 KB
testcase_17 AC 167 ms
57,852 KB
testcase_18 AC 169 ms
58,404 KB
testcase_19 AC 174 ms
58,928 KB
testcase_20 AC 176 ms
58,740 KB
testcase_21 AC 177 ms
58,268 KB
testcase_22 AC 192 ms
59,288 KB
testcase_23 AC 200 ms
59,580 KB
testcase_24 AC 207 ms
59,680 KB
testcase_25 AC 205 ms
59,352 KB
testcase_26 AC 209 ms
59,492 KB
testcase_27 AC 125 ms
55,596 KB
testcase_28 AC 152 ms
56,072 KB
testcase_29 AC 164 ms
56,540 KB
testcase_30 AC 161 ms
56,284 KB
testcase_31 AC 167 ms
56,656 KB
testcase_32 AC 169 ms
58,308 KB
testcase_33 AC 180 ms
59,632 KB
testcase_34 AC 182 ms
57,404 KB
testcase_35 AC 194 ms
59,852 KB
testcase_36 AC 197 ms
59,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int people = sc.nextInt();

        String[][] greetings = new String[people][people];

        for (int i = 0; i < people; i++) {

            for (int j = 0; j < people; j++) {
                greetings[i][j] = sc.next();
            }

        }

        int[] rengeCount = new int[people];

        for (int i = 0; i < people; i++) {

            for (int j = 0; j < people; j++) {

                if (greetings[i][j].equals("nyanpass")) {
                    rengeCount[j]++;
                }

            }

        }

        int renge = -1;

        for (int i = 0; i < people; i++) {

            if (rengeCount[i] == people - 1) {

                if (renge == -1) {
                    renge = i + 1;
                } else {
                    renge = -1;
                    break;
                }

            }

        }

        System.out.println(renge);

    }

}
0