A
#include "bits/stdc++.h"
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x;
cin >> x;
cout << (x % 2 ? "No" : "Yes") << '\n';
return 0;
}
B
#include "bits/stdc++.h"
using namespace std;
void solve() {
int x, y;
cin >> x >> y;
int z = gcd(x, y);
cout << (x + z > y && y + z > x ? "Yes" : "No") << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
C
#include "bits/stdc++.h"
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string s;
cin >> n >> s;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
for (char x : {'r' , 'e', 'd'}) {
if (x != s[i - 1] && ((i + 1 < n && x != s[i + 1]) || i == n - 1)) {
s[i] = x;
break;
}
}
}
}
cout << s << '\n';
return 0;
}
D
#include "bits/stdc++.h"
using namespace std;
int a[20];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
function<void(int, int)> dfs = [&](int n, int i) {
if (!n) {
for (int j = 0; j < i; j++) {
cout << a[j] << " \n"[j == i - 1];
}
return;
}
for (int j = 1; j <= n; j++) {
if ((i && j != a[i - 1]) || !i) {
a[i] = j;
dfs(n - j, i + 1);
a[i] = 0;
}
}
};
dfs(n, 0);
return 0;
}
E
#include "bits/stdc++.h"
using namespace std;
using i64 = int64_t;
constexpr int N = 1E6;
int c[N + 1];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
c[a[i]]++;
}
i64 ans = 0;
for (int i = 1; i <= N; i++) {
i64 res = 0;
for (int j = i; j <= N; j += i) {
res += i64(j) * c[j];
}
ans = max(ans, res * i);
}
cout << ans << '\n';
return 0;
}
F
#include "bits/stdc++.h"
using namespace std;
using i64 = int64_t;
constexpr int P = 998244353;
i64 power(i64 a, i64 b, int p = P) {
i64 r = 1;
for (; b > 0; b >>= 1, a = a * a % p) {
if (b & 1) {
r = r * a % p;
}
}
return r;
}
i64 inv(i64 a) {
return power(a, P - 2);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
i64 n;
cin >> n;
i64 ans = n % P * 49 % P;
ans = (ans + (power(10, n) - 1 + P) % P * 40 % P) % P;
ans = (ans + (power(100, n) - 1 + P) % P * inv(99) % P * 400 % P) % P;
ans = (ans + (P - (power(10, n) - 1 + P) % P * inv(9) % P * 80 % P)) % P;
ans = ans * inv(81) % P;
cout << ans << '\n';
return 0;
}