結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Eclair1015Eclair1015
提出日時 2018-05-26 02:50:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 65,240 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-28 18:07:59
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:32:16: warning: 'east' may be used uninitialized [-Wmaybe-uninitialized]
   32 |         if(west==east && west==0){
      |            ~~~~^~~~~~
main.cpp:7:18: note: 'east' was declared here
    7 |         int west,east,a;
      |                  ^~~~
main.cpp:32:30: warning: 'west' may be used uninitialized [-Wmaybe-uninitialized]
   32 |         if(west==east && west==0){
      |                          ~~~~^~~
main.cpp:7:13: note: 'west' was declared here
    7 |         int west,east,a;
      |             ^~~~

ソースコード

diff #

#include<iostream>
#include<string.h>

using namespace std;
int main(){
	char c[101];
	int west,east,a;
	
	cin>>c;
	a=strlen(c);
	for(int i=0;i<a;i++){
		if(c[i]=='O'){
			east++;
		}else if(c[i]=='X'){
			west++;
		}
		
		if(east==3){
			if(west==0){
				cout<<"East"<<endl;
				return 0;
			}
			east=0;
		}else if(west==3){
			if(east==0){
				cout<<"West"<<endl;
				return 0;
			}
			west=0;
		}
	}
	if(west==east && west==0){
		cout<<0<<endl;
	}
	return 0;
}
0