結果

問題 No.486 3 Straight Win(3連勝)
コンテスト
ユーザー AQUA16573837
提出日時 2018-03-12 00:53:15
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 393 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 196 ms
コンパイル使用メモリ 51,012 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-12 18:34:52
合計ジャッジ時間 958 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:24: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   21 |         char *ss[] = { "NA", "East", "West" };
      |                        ^~~~
main.cpp:21:30: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   21 |         char *ss[] = { "NA", "East", "West" };
      |                              ^~~~~~
main.cpp:21:38: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   21 |         char *ss[] = { "NA", "East", "West" };
      |                                      ^~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
	char s[101];
	scanf("%s", s);
	int carry = 1, res = 0;
	for (int i = 1; s[i] != 0; i++) {
		if (s[i] != s[i - 1]) {
			carry = 1;
		} else {
			carry++;
			if (3 <= carry) {
				res = s[i] == 'O' ? 1 : 2;
				break;
			}
		}
	}
	char *ss[] = { "NA", "East", "West" };
	printf("%s\n", ss[res]);
}
0