結果

問題 No.239 にゃんぱすー
ユーザー tska
提出日時 2015-09-17 15:10:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 58,240 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 06:52:29
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 7 WA * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:23: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |                 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