补题链接:Here
A - Century
整除 (200) 并且判断能否整除完全
B - 200th ABC-200
按题意即可
C - Ringo's Favorite Numbers 2
求出 (A_i - A_j) 为 200 的倍数的个数,转化为贡献值即可
using ll = long long;
void solve() {
ll ans = 0;
int n, a[210] = {0};
cin >> n;
for (ll i = 1, x; i <= n; ++i) {
cin >> x;
x %= 200;
ans += a[x];
a[x]++;
}
cout << ans << '
';
}
D - Happy Birthday! 2
搜索情况
int n, a[205];
vector<int> c[205], b;
void dfs(int x, int sum) {
if (c[sum].size() && b != c[sum]) {
cout << "Yes
";
cout << b.size() << ' ';
for (int i : b) cout << i << ' ';
cout << "
";
cout << c[sum].size() << ' ';
for (int i : c[sum]) cout << i << ' ';
cout << "
";
exit(0);
} else if (b.size())
c[sum] = b;
if (x == n + 1) return;
dfs(x + 1, sum);
b.push_back(x), dfs(x + 1, (sum + a[x]) % 200), b.pop_back();
}
void solve() {
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i];
dfs(1, 0);
cout << "No
";
}
E - Patisserie ABC 2
DP
using ll = long long;
const int N = 3e6 + 10;
ll f[4][N];
void solve() {
ll n, k;
cin >> n >> k;
f[0][0] = 1;
for (int i = 1; i <= 3; i++)
for (int j = 1; j <= 3 * n; j++)
f[i][j] = f[i][j - 1] + f[i - 1][j - 1] - (j > n ? f[i - 1][j - 1 - n] : 0);
ll s;
for (s = 3; k > f[3][s]; s++)
k -= f[3][s];
for (int i = 2, v; i >= 1; i--) {
for (v = 1; k > f[i][s - v]; v++)
k -= f[i][s - v];
cout << v << " ";
s -= v;
}
cout << s << "
";
}