結果

問題 No.239 にゃんぱすー
ユーザー 37zigen
提出日時 2016-03-11 19:16:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 3,376 ms
コンパイル使用メモリ 79,464 KB
実行使用メモリ 58,924 KB
最終ジャッジ日時 2024-09-25 00:52:18
合計ジャッジ時間 12,114 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;

import java.util.Date;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		long exec_time=new Date().getTime();
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[][] str=new String[n][n];

		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				str[i][j]=sc.next();
			}
		}
		int ans=-1;
		int cnt=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(i==j||str[j][i].equals("nyanpass")){
					if(j==n-1){
						ans=i+1;
						cnt++;
					}
					continue;
				}else{
					break;
				}
			}
		}
		if(cnt>1)ans=-1;
		System.out.println(ans);
		System.err.println(new Date().getTime()-exec_time+"ms");

	}
}
0