結果
| 問題 | 
                            No.239 にゃんぱすー
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-04-21 16:44:48 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 228 ms / 2,000 ms | 
| コード長 | 637 bytes | 
| コンパイル時間 | 2,923 ms | 
| コンパイル使用メモリ | 74,468 KB | 
| 実行使用メモリ | 58,132 KB | 
| 最終ジャッジ日時 | 2024-10-04 14:32:54 | 
| 合計ジャッジ時間 | 9,986 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
package yukicorder;
import java.util.Scanner;
public class No239 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[][] murabito = new String[n][n];
		int count = 0;
		int ans = -1;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				murabito[i][j] = sc.next();
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i==j||murabito[j][i].equals("nyanpass")){
					if(j==n-1){
						ans=i+1;
						count++;
					}
					continue;
				}else{
					break;
				}
			}
		}
		if(count > 1){
			ans = -1;
		}
		System.out.println(ans);
	}
}