T1: tcdr
模拟
代码实现
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
erase_if(s, [](char c) { return ranges::count("aeiou", c); });
cout << s << '\n';
return 0;
}
T2:The Middle Day
模拟
代码实现
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> d(n);
rep(i, n) cin >> d[i];
int tot = reduce(d.begin(), d.end());
int k = (tot+1)/2;
rep(i, n) {
if (k <= d[i]) {
cout << i+1 << ' ' << k << '\n';
break;
}
k -= d[i];
}
return 0;
}
T3:Flavors
显然必选最美味的冰激凌,然后枚举另一个即可
代码实现
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> f(n), s(n);
rep(i, n) cin >> f[i] >> s[i];
int a = 0, ai = -1;
rep(i, n) {
if (a < s[i]) {
a = s[i];
ai = i;
}
}
int b = 0;
rep(i, n) {
if (i == ai) continue;
if (f[i] == f[ai]) b = max(b, s[i]/2);
else b = max(b, s[i]);
}
int ans = a+b;
cout << ans << '\n';
return 0;
}