結果

問題 No.486 3 Straight Win(3連勝)
ユーザー Toshihiko Yanase
提出日時 2018-05-02 21:13:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 59,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 00:22:57
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  string S;
  cin >> S;

  int east = 0;
  int west = 0;

  for(int i=0;i<S.size();i++){
    if(S.at(i) == 'O'){
      west = 0;
      east++;
    }else{
      east = 0;
      west++;
    }
    if(west >= 3 || east >= 3) break;
  }
  if(east >= 3){
    cout << "East" << endl;
  }else if(west >= 3){
    cout << "West" << endl;
  }else{
    cout << "NA" << endl;
  }

  return 0;
}
0