結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2016-11-12 22:01:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 224 ms / 2,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 2,065 ms |
コンパイル使用メモリ | 74,620 KB |
実行使用メモリ | 45,420 KB |
最終ジャッジ日時 | 2024-11-25 21:38:07 |
合計ジャッジ時間 | 9,079 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int N = Integer.parseInt( sc.nextLine() );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);break;}}}}}