結果

問題 No.239 にゃんぱすー
ユーザー cande398cande398
提出日時 2017-10-16 00:31:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 2,207 ms
コンパイル使用メモリ 77,528 KB
実行使用メモリ 46,920 KB
最終ジャッジ日時 2024-04-28 22:12:27
合計ジャッジ時間 9,990 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,208 KB
testcase_01 AC 129 ms
40,948 KB
testcase_02 AC 134 ms
41,136 KB
testcase_03 AC 138 ms
40,860 KB
testcase_04 AC 136 ms
41,120 KB
testcase_05 AC 134 ms
40,948 KB
testcase_06 AC 132 ms
41,336 KB
testcase_07 AC 135 ms
41,744 KB
testcase_08 AC 141 ms
41,380 KB
testcase_09 AC 148 ms
41,288 KB
testcase_10 AC 153 ms
41,588 KB
testcase_11 AC 174 ms
41,872 KB
testcase_12 AC 180 ms
41,472 KB
testcase_13 AC 179 ms
41,532 KB
testcase_14 AC 178 ms
42,196 KB
testcase_15 AC 180 ms
42,432 KB
testcase_16 AC 187 ms
42,468 KB
testcase_17 AC 193 ms
42,052 KB
testcase_18 AC 196 ms
43,012 KB
testcase_19 AC 203 ms
43,344 KB
testcase_20 AC 203 ms
43,460 KB
testcase_21 AC 209 ms
43,996 KB
testcase_22 AC 220 ms
44,620 KB
testcase_23 AC 219 ms
44,872 KB
testcase_24 AC 220 ms
45,608 KB
testcase_25 AC 229 ms
46,544 KB
testcase_26 AC 226 ms
46,484 KB
testcase_27 AC 138 ms
41,064 KB
testcase_28 AC 168 ms
41,540 KB
testcase_29 AC 183 ms
41,928 KB
testcase_30 AC 182 ms
42,092 KB
testcase_31 AC 177 ms
42,228 KB
testcase_32 AC 194 ms
42,840 KB
testcase_33 AC 214 ms
43,728 KB
testcase_34 AC 209 ms
44,436 KB
testcase_35 AC 223 ms
45,720 KB
testcase_36 AC 229 ms
46,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
    public static void main(String[] args){
        int i,j,poi = 0;
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] count = new int[num];
        String[][] line = new String[num][num];
        for(i=0;i<num;i++){
            for(j=0;j<num;j++){
                line[i][j] = sc.next();
            }
        }
        for(j=0;j<num;j++){
            for(i=0;i<num;i++){
                if(i==j && line[i][j].equals("-"))count[j]++;
                else if(line[i][j].equals("nyanpass"))count[j]++;
            }
            if(count[j] == num)poi++;
        }
        if(poi == 1){
            for(i=0;i<num;i++)
                if(count[i] == num)System.out.println(i+1);
        }
        else System.out.println("-1"); 
    }
}
0