結果

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

ソースコード

diff #

#include<stdio.h>

int main(void){
  int o=0,x=0;
  char str[128];
  int i;
  scanf("%s",str);
  for(i=0;str[i]!='\0';i++){
    if(str[i]=='O'){
      o++;
      x=0;
      if(o==3){
        puts("East");
        return 0;
      }
   }else if(str[i]=='X'){
      x++;
      o=0;
      if(x==3){
        puts("West");
        return 0;
      }
   }
}
puts("NA");
  return 0;
}
0