跳到正文

题解

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

Ethan_sun约 2 分钟
原文
文章信息与版本

文章信息

发布
2026年2月3日
收录
2026年2月5日
更新
2026年11月16日
篇幅
约 2 分钟
获赞
7
题目
P15159

版本

  1. v2当前
  2. v1

P15159 [SWERC 2024] Ook? Ook!

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

solution

什么神仙题。

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

没了。

AC code

C++
#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;
}
原文
存档评论3 条抓取于