結果

問題 No.486 3 Straight Win(3連勝)
ユーザー rapurasurapurasu
提出日時 2017-02-24 22:29:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 144,496 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 10:39:37
合計ジャッジ時間 2,300 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int A[101];
int main(){
	string S;
	cin>>S;
	REP(i,S.size()){
	    if(S[i]=='O'){
	       A[i]=0;
	    }else{
	       A[i]=1;
	    }
	}
	int cnt=1;
	int p=A[0];
	if(S.size()<2){
	   cout<<"NA"<<endl;
	   return 0;
	}
	for(int i=1;i<S.size();i++){
	    if(p==A[i]){
	       cnt++;
	       if(cnt>=3){
	          if(p==0){
	             cout<<"East"<<endl;
	          }else{
	             cout<<"West"<<endl;
	          }
	          return 0;
	       }
	    }else{
	       cnt=1;
	       p=A[i];
	    }
	}
	cout<<"NA"<<endl;
	return(0);
}
0