結果

問題 No.239 にゃんぱすー
ユーザー tskatska
提出日時 2015-09-17 15:10:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 60,920 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-26 12:22:49
合計ジャッジ時間 2,071 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,384 KB
testcase_09 WA -
testcase_10 AC 3 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 4 ms
4,376 KB
testcase_21 WA -
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 5 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:9: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   cout<<ans<<endl;
         ^~~

ソースコード

diff #

//yukicoder No.239 にゃんぱすー
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
const int MAX_N = 100;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n; cin>>n;
	int ans;
	string a[MAX_N][MAX_N];
	rep(i,n){	//input
		rep(j,n){
			cin>>a[i][j];
		}
	}
	rep(i,n){	//summer
		rep(j,n){
			if(a[i][j]=="nyanpass"){
				if(ans==i-1){
					ans=-1;
					break;
				}
				ans=i-1;
			}
		}
	}
	if(ans==0){
		cout<<"-1"<<endl;
	}else{
		cout<<ans<<endl;
	}
	return 0;
}
0