結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Eclair1015Eclair1015
提出日時 2018-05-26 02:50:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 64,032 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 03:34:50
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:32:16: 警告: ‘east’ may be used uninitialized [-Wmaybe-uninitialized]
   32 |         if(west==east && west==0){
      |            ~~~~^~~~~~
main.cpp:7:18: 備考: ‘east’ はここで定義されています
    7 |         int west,east,a;
      |                  ^~~~
main.cpp:32:30: 警告: ‘west’ may be used uninitialized [-Wmaybe-uninitialized]
   32 |         if(west==east && west==0){
      |                          ~~~~^~~
main.cpp:7:13: 備考: ‘west’ はここで定義されています
    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