結果

問題 No.239 にゃんぱすー
ユーザー 練習生
提出日時 2015-08-22 12:36:48
言語 Java
(openjdk 23)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 3,389 ms
コンパイル使用メモリ 75,560 KB
実行使用メモリ 54,256 KB
最終ジャッジ日時 2024-07-18 12:43:28
合計ジャッジ時間 10,322 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No239 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean notNyanpass[] = new boolean[n];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				String aisatu = sc.next();
				if(!(aisatu.equals("-")) && !(aisatu.equals("nyanpass"))){
					notNyanpass[j] = true;
				}
			}
		}
		sc.close();
		int renchonCount = 0;
		int renchon = 0;
		for(int i = 0; i < n; i++){
			if(notNyanpass[i] == false){
				renchonCount++;
				renchon = i + 1;
			}
		}
		if(renchonCount == 1){
			System.out.println(renchon);
		}else{
			System.out.println(-1);			
		}
	}
}
0