結果

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