結果

問題 No.239 にゃんぱすー
ユーザー kohaku_kohaku
提出日時 2016-11-12 21:55:02
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 833 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 41,616 KB
最終ジャッジ日時 2024-11-25 21:37:50
合計ジャッジ時間 7,680 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] count = new int [N];
        for(int i=0; i<N; i++){
            String tem = sc.nextLine();
            String [] arr = tem.split(" ");
            for(int j=0; j<N; j++){
                if( "nyanpass".equals(arr[j]) ){
                    count[j]++;
                }
            }
        }
        int f = 0;
        for(int i=0; i<N; i++){
            if(count[i]==N-1){
                f++;
            }
        }
        if(f!=1){
            System.out.println(-1);
        }else{
            for(int i=0; i<N; i++){
                if(count[i]==N-1){
                    System.out.println(i+1);
                }
            }
        }
    }
}
0