結果

問題 No.486 3 Straight Win(3連勝)
ユーザー 57tggx
提出日時 2017-04-06 21:23:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 04:25:04
合計ジャッジ時間 1,005 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s", S);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	char S[100];
	unsigned e = 0, w = 0;
	scanf("%s", S);
	for(unsigned i = 0; S[i]; i++){
		if(S[i] == 'O'){
			e++;
			w = 0;
		}else{
			w++;
			e = 0;
		}
		if(e == 3){
			printf("East\n");
			return 0;
		}else if(w == 3){
			printf("West\n");
			return 0;
		}
	}
	printf("NA\n");
	return 0;
}
0