結果
| 問題 |
No.486 3 Straight Win(3連勝)
|
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-12 00:53:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 393 bytes |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 33,612 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 04:39:50 |
| 合計ジャッジ時間 | 1,119 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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" };
| ^~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", s);
| ~~~~~^~~~~~~~~
ソースコード
#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]);
}
AQUA16573837