結果

問題 No.486 3 Straight Win(3連勝)
ユーザー ふっぴー
提出日時 2017-04-11 14:21:54
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 04:25:12
合計ジャッジ時間 919 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%s",s);
      |   ^~~~~~~~~~~~~

ソースコード

diff #

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

int main(void){
  char s[150];
  scanf("%s",s);
  int cnt=1;
  char c=s[0];
  int i=1;
  while(s[i]!='\0'){
    if(s[i]==c){
      cnt++;
    }else{
      cnt=1;
      c=s[i];
    }
    if(cnt==3){
      if(c=='O'){
	printf("East\n");
	return 0;
      }else{
	printf("West\n");
	return 0;
      }
    }
    i++;
  }
  printf("NA\n");
  return 0;
}
0