結果
| 問題 |
No.486 3 Straight Win(3連勝)
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-10-02 23:15:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 985 bytes |
| コンパイル時間 | 996 ms |
| コンパイル使用メモリ | 93,768 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 10:06:49 |
| 合計ジャッジ時間 | 1,884 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
using namespace std;
int main() {
int i, j, k;
string s;
cin >> s;
int cnth = 0, cntn = 0;
int flag = 0; // 1=higasi 2=nisi
for (i = 0; i < s.length(); i++) {
if (s[i] == 'O') {
if (flag == 1) {
cnth++;
if (cnth == 3) {
cout << "East" << endl;
break;
}
}
else {
flag = 1;
cntn = 0;
cnth = 1;
}
}
else if (s[i] == 'X') {
if (flag == 2) {
cntn++;
if (cntn == 3) {
cout << "West" << endl;
break;
}
}
else {
flag = 2;
cnth = 0;
cntn = 1;
}
}
}
if (cnth != 3 && cntn != 3) {
cout << "NA" << endl;
}
getchar();
getchar();
return 0;
}
aaa