結果

問題 No.239 にゃんぱすー
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-06 22:20:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 946 bytes
コンパイル時間 4,335 ms
コンパイル使用メモリ 77,624 KB
実行使用メモリ 40,032 KB
最終ジャッジ日時 2024-04-17 05:22:38
合計ジャッジ時間 7,221 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,056 KB
testcase_01 AC 51 ms
37,044 KB
testcase_02 AC 54 ms
37,012 KB
testcase_03 AC 53 ms
36,832 KB
testcase_04 AC 53 ms
36,828 KB
testcase_05 AC 52 ms
36,532 KB
testcase_06 AC 52 ms
36,844 KB
testcase_07 AC 52 ms
37,072 KB
testcase_08 AC 52 ms
36,636 KB
testcase_09 AC 53 ms
36,836 KB
testcase_10 AC 54 ms
37,044 KB
testcase_11 AC 55 ms
36,988 KB
testcase_12 AC 54 ms
36,940 KB
testcase_13 AC 57 ms
37,372 KB
testcase_14 AC 58 ms
37,388 KB
testcase_15 AC 69 ms
37,376 KB
testcase_16 AC 64 ms
37,624 KB
testcase_17 AC 85 ms
38,036 KB
testcase_18 AC 76 ms
38,256 KB
testcase_19 AC 86 ms
38,536 KB
testcase_20 AC 80 ms
38,884 KB
testcase_21 AC 82 ms
39,044 KB
testcase_22 AC 92 ms
39,188 KB
testcase_23 AC 91 ms
39,028 KB
testcase_24 AC 107 ms
39,380 KB
testcase_25 AC 107 ms
39,104 KB
testcase_26 AC 109 ms
39,664 KB
testcase_27 AC 57 ms
37,056 KB
testcase_28 AC 54 ms
37,120 KB
testcase_29 AC 56 ms
37,172 KB
testcase_30 AC 61 ms
37,268 KB
testcase_31 AC 79 ms
37,912 KB
testcase_32 AC 74 ms
38,268 KB
testcase_33 AC 79 ms
38,576 KB
testcase_34 AC 99 ms
39,180 KB
testcase_35 AC 109 ms
39,536 KB
testcase_36 AC 111 ms
40,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Exercise64{
  public static void main (String[] args) throws IOException{

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String num = new String(in.readLine());
    int n = Integer.parseInt(num);

    String[][] greetings = new String[n][n];

    for(int i = 0; i < n; i++){
      String str = new String(in.readLine());
      String[] strArray = str.split(" ");
      greetings[i] = strArray;
    }

    LinkedList<Integer> answer = new LinkedList<Integer>();
    for(int a = 0; a < n; a++){
      boolean flag = true;
      for(int b = 0; b < n; b++){
        if (!greetings[b][a].equals("nyanpass") && !greetings[b][a].equals("-")){
          flag = false;
        }
      }
      if (flag){
        answer.add(a + 1);
      }
    }
    if (answer.size() == 1){
      System.out.println(answer.get(0));
    }else{
      System.out.println(-1);
    }
  }
}
0