結果
問題 | No.52 よくある文字列の問題 |
ユーザー | kpinkcat |
提出日時 | 2023-10-10 11:07:31 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 822 bytes |
コンパイル時間 | 1,073 ms |
コンパイル使用メモリ | 110,088 KB |
実行使用メモリ | 4,476 KB |
最終ジャッジ日時 | 2023-10-10 11:07:44 |
合計ジャッジ時間 | 1,962 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 2 ms
4,352 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
4,352 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | RE | - |
testcase_10 | AC | 1 ms
4,348 KB |
ソースコード
#include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<vector> #include<set> #include<list> #include<queue> #include<math.h> #include<bitset> using ll = long long; using namespace std; int main(){ string s; int ans = 0; cin >> s; deque<string> dq; dq.push_back(s); while (!dq.empty()){ string tmp1, tmp2, tmp3; tmp3 = dq.front(); dq.pop_front(); tmp1 = tmp2 = tmp3; tmp2.pop_back(); tmp1 = tmp1.substr(1); if (tmp1 == tmp2){ if (tmp1.size() == 1) ans++; else dq.push_back(tmp1); } else { if (tmp1.size() == 1) ans += 2; else { dq.push_back(tmp1); dq.push_back(tmp2); } } } cout << ans << endl; }