牛客周赛 Round 29(小白)
A.小红大战小紫
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
IO;
int a, b; cin >> a >> b;
if (a > b) cout << "kou\n";
else if (a < b) cout << "yukari\n";
else cout << "draw\n";
return 0;
}
B.小红的白日梦
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
IO;
int n, ans = 0, cnt;
string s1, s2; cin >> n >> s1 >> s2;
for (int i = 0; i < n; i++) {
cnt = 0;
if (s1[i] == 'Y') cnt += 2;
if (s2[i] == 'Y') cnt += 1;
if (cnt == 1) ans += 2;
else ans += cnt;
}
return cout << ans << '\n', 0;
}
C.小红的小小红
/*
必包含xiaohong
*/
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int mp[26] = {0};
int main()
{
IO;
string s; cin >> s;
for(auto& x : s) mp[x - 'a']++;
string tmp = "xiaohong";
for (auto& x :tmp) mp[x - 'a']--;
cout << tmp;
for (int i = 0; i < 26; i++) {
while (mp[i]--) {
cout << char(i + 'a');
}
}
return cout << '\n', 0;
}
D.
| 小红的中位数 |