結果
| 問題 |
No.495 (^^*) Easy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-09 06:22:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 633 bytes |
| コンパイル時間 | 1,901 ms |
| コンパイル使用メモリ | 195,884 KB |
| 最終ジャッジ日時 | 2025-01-11 00:27:23 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
const double PI = acos(-1);
string replace_all(string s, string target, string x) {
int pos = 0;
while ((pos = s.find(target, pos)) != string::npos) {
s.replace(pos, target.length(), x);
pos += x.length();
}
return s;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
string x = "(^^*)";
string y = "(*^^)";
s = replace_all(s, x, "x");
s = replace_all(s, y, "y");
cout << count(s.begin(), s.end(), 'x') << " " << count(s.begin(), s.end(), 'y') << endl;
return 0;
}