結果

問題 No.239 にゃんぱすー
ユーザー kou6839
提出日時 2015-07-16 16:12:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 75,944 KB
実行使用メモリ 46,492 KB
最終ジャッジ日時 2024-07-08 08:12:57
合計ジャッジ時間 8,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.Frame;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String[][] table = new String[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				table[i][j]=sc.next();
			}
		}
		int ans = -1;
		t:for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i==j) continue;
				if(!table[j][i].equals("nyanpass")){
					continue t;
				}
			}
			if(ans==-1){
				ans = i+1;
			}else{
				System.out.println(-1);
				return;
			}
		}
		System.out.println(ans);
	}
}
0