結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-21 22:44:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 143 ms / 2,000 ms |
| コード長 | 688 bytes |
| コンパイル時間 | 728 ms |
| コンパイル使用メモリ | 68,096 KB |
| 最終ジャッジ日時 | 2025-01-09 22:11:28 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
#include <string>
const std::string ls = "^^*$", rs = "*^^$";
void solve() {
std::string s;
std::cin >> s;
int n = s.length();
int l = 0, r = 0;
for (int i = 0; i < n; ++i) {
if (s[i] != '(') continue;
int li = 0, ri = 0;
for (int j = i + 1; j < n; ++j) {
if (s[j] == ls[li]) ++li;
if (s[j] == rs[ri]) ++ri;
if (s[j] == ')') {
if (li == 3) ++l;
if (ri == 3) ++r;
}
}
}
std::cout << l << " " << r << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}