結果

問題 No.239 にゃんぱすー
ユーザー kano_town
提出日時 2015-07-13 16:09:29
言語 Java
(openjdk 23)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 3,046 ms
コンパイル使用メモリ 74,792 KB
実行使用メモリ 46,204 KB
最終ジャッジ日時 2024-07-08 07:02:15
合計ジャッジ時間 9,692 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yukicoder239 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), res = -1;
        int cnt[] = new int[n];
        for (int i = 0; i < n; i++) 
            for (int j = 0; j < n; j++) 
                if (sc.next().equals("nyanpass")) 
                    cnt[j]++;
        for (int j = 0; j < n; j++) {
            if (cnt[j] == n-1) {
                if (res == -1) {
                    res = j + 1;
                } else {
                    res = -1;
                    break;
                }
            }
        }
        System.out.println(res);
    }
}
0