結果

問題 No.486 3 Straight Win(3連勝)
ユーザー face4
提出日時 2018-04-20 21:37:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 63,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 05:17:17
合計ジャッジ時間 1,364 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int score = 0;
    char c;
    for(; abs(score) != 3 && cin >> c;){
        if(c == 'O'){
            if(score > 0)  score++;
            else           score = 1;
        }else if(c == 'X'){
            if(score < 0)  score--;
            else           score = -1;
        }
    }

    if(abs(score) == 3){
        if(score == 3)  cout << "East";
        else            cout << "West";
    }else{
        cout << "NA";
    }

    cout << endl; 
    return 0;
}
0