結果

問題 No.486 3 Straight Win(3連勝)
ユーザー suppy193
提出日時 2017-02-27 09:58:57
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 04:10:41
合計ジャッジ時間 956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	char s[101];
	int i;
	int east = 0, west = 0;
	scanf("%s", s);
	for(i = 0;s[i] != '\0';i++){
		if(s[i] == 'O'){
			east++;
			west = 0;
		}
		else{
			east = 0;
			west++;
		}
		if(east == 3){
			printf("East\n");
			return 0;
		}
		else if(west == 3){
			printf("West\n");
			return 0;
		}
	}
	printf("NA\n");
	
	return 0;
}
0