結果

問題 No.486 3 Straight Win(3連勝)
コンテスト
ユーザー Eclair1015
提出日時 2018-05-26 02:50:44
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 464 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 333 ms
コンパイル使用メモリ 76,932 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-17 18:10:43
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:25: warning: 'west' may be used uninitialized [-Wmaybe-uninitialized]
   19 |                         if(west==0){
      |                         ^~
main.cpp:7:13: note: 'west' was declared here
    7 |         int west,east,a;
      |             ^~~~
main.cpp:13:29: warning: 'east' may be used uninitialized [-Wmaybe-uninitialized]
   13 |                         east++;
      |                         ~~~~^~
main.cpp:7:18: note: 'east' was declared here
    7 |         int west,east,a;
      |                  ^~~~

ソースコード

diff #
raw source code

#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