結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Mcpu3
提出日時 2018-04-30 16:40:11
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 27,904 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 23:55:43
合計ジャッジ時間 1,050 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:7:9: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |         gets(s);
      |         ^~~~
      |         fgets
/usr/bin/ld: /tmp/ccBZysOK.o: in function `main':
main.c:(.text.startup+0x3e): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main(void)
{
	char s[101], *p, *q, t[] = "OOO", u[] = "XXX", v[] = "East", w[] = "West";
	gets(s);
	if (strstr(s, t) != NULL && strstr(s, u) != NULL) {
		p = strstr(s, t);
		q = strstr(s, u);
		puts(p < q ? v : w);
	}
	else if (strstr(s, t) != NULL) puts(v);
	else if (strstr(s, u) != NULL) puts(w);
	else puts("NA");
	return 0;
}
0