题解:P15159 [SWERC 2024] Ook? Ook!

· · 题解

P15159 [SWERC 2024] Ook? Ook!

upd:链接挂错了,修改之后重新交审。

solution

什么神仙题。

观察样例得到 O 的莫尔斯电码为 .-.-,K 的莫尔斯电码为 .-。

没了。

AC code

#include <bits/stdc++.h>
#define debug(a) cerr << (#a) << " = " << (a) << endl;
#define int long long
#define maxn 100010
#define endl '\n'
using namespace std;

string s;
void solve() {
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'O') {
            cout << ".-.-";
        }
        else if (s[i] == 'K') {
            cout << ".-";
        }
    }
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t; t = 1;
    while (t--) {
        cin >> s;
        solve();
    }
    return 0;
}