結果

問題 No.486 3 Straight Win(3連勝)
ユーザー
提出日時 2017-02-27 07:42:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 58,732 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 04:10:43
合計ジャッジ時間 1,344 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(int ac, char **av) {
  string s;
  int n = 0, m = 0;
  cin >> s;
  for (char c : s) {
    if (c == 'O') {
      n++;
      m = 0;
    } else {
      m++;
      n = 0;
    }
    if (abs(n-m) == 3) {
      cout << (((n-m)<0)?"West":"East") << endl;
      return 0;
    }
  }
  cout << "NA" << endl;
  return 0;
}
0