結果
| 問題 | No.1016 三目並べ |
| コンテスト | |
| ユーザー |
rsk0315
|
| 提出日時 | 2020-04-03 21:45:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 612 bytes |
| 記録 | |
| コンパイル時間 | 956 ms |
| コンパイル使用メモリ | 63,484 KB |
| 最終ジャッジ日時 | 2025-01-09 12:47:51 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%d", &t);
| ~~~~~^~~~~~~~~~
main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%zu %s", &n, buf);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <algorithm>
#include <string>
bool g(std::string const& s, std::string const& t) {
return (std::search(s.begin(), s.end(), t.begin(), t.end()) != s.end());
}
char f(std::string const& s) {
if (g(s, "-o--")) return true;
if (g(s, "--o-")) return true;
if (g(s, "-oo")) return true;
if (g(s, "o-o")) return true;
if (g(s, "oo-")) return true;
if (g(s, "ooo")) return true;
return false;
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
size_t n;
char buf[1024];
scanf("%zu %s", &n, buf);
std::string s = buf;
puts(f(s)? "O": "X");
}
}
rsk0315