B、Mask Allocation








%E9%87%8C%E9%9D%A2%E5%BE%AA%E7%8E%AFk%E6%AC%A1k%EF%BC%8C%E7%9B%B4%E5%88%B0%E4%B8%80%E6%96%B9%E6%BB%A1%E8%B6%B3%E4%BA%86%E9%9C%80%E6%B1%82%EF%BC%8C%E7%A8%8B%E5%BA%8F%E5%B0%B1%E7%BB%93%E6%9D%9F%E4%BA%86&preview=true)
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,O3,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define mk(__x__,__y__) make_pair(__x__,__y__)
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
inline int lowbit(int x) { return x & (-x); }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
vector<int> a;
int main() {
int T = read();
while (T--) {
a.clear();
int n = read(), m = read();
while (n) {
if (n < m) swap(n, m);
for (int i = 1; i <= m; ++i) a.push_back(m);
n -= m;
}
print(a.size());
for (auto it : a)
print(it, 32);
puts("");
}
return 0;
}
D、Fake News



#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,O3,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define mk(__x__,__y__) make_pair(__x__,__y__)
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
inline int lowbit(int x) { return x & (-x); }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
int main() {
int T = read();
while (T--) {
ll n = read();
if (n == 1 or n == 24) puts("Fake news!");
else puts("Nobody knows it better than me!");
}
return 0;
}
H、Dividing

%E4%B8%80%E5%AE%9A%E6%98%AF%E4%B8%80%E4%B8%AA%E6%BB%A1%E8%B6%B3%E6%9D%A1%E4%BB%B6%E7%9A%84%E5%85%83%E7%BB%84%EF%BC%8C%E8%80%8C%E4%B8%94%E5%A6%82%E6%9E%9C(n%2Ck)%E6%98%AF%E4%B8%80%E4%B8%AA%E5%85%83%E7%BB%84%E9%82%A3%E4%B9%88(n%2Bk%2Ck)%E5%92%8C(nk%2Ck)%E4%B9%9F%E6%98%AF%E5%85%83%E7%BB%84&preview=true)

%E5%8F%AF%E4%BB%A5%E9%82%A3%E4%B9%88(k%2Ck)%2C(k%2B1%2Ck)%2C(2*k%2Ck)%2C(2*k%2B1%2Ck)%E4%B9%9F%E4%B8%80%E5%AE%9A%E5%8F%AF%E4%BB%A5%E5%B9%B6%E4%B8%94%E8%BF%99%E5%B0%B1%E6%98%AF%E5%85%A8%E9%83%A8%E7%9A%84%E5%8F%AF%E8%83%BD&preview=true)


%E4%B8%AD%E7%9A%84%E4%BB%8E2%E5%80%8D%E5%BC%80%E5%A7%8B(i%2Cj)%E5%AF%B9%E6%95%B0%E9%87%8F%E5%8D%B3i%3D2*j%E6%88%96%E8%80%853*j%E7%B4%AF%E8%AE%A1%E4%B8%8B%E5%8E%BB%E7%9A%84%E6%95%B0%E9%87%8F&preview=true)
%3Dk*k%2BK%2C%E8%BF%99%E9%87%8C%E5%8F%AF%E4%BB%A5%E7%9B%B4%E6%8E%A5%E8%B7%B3%E5%87%BA%E5%B0%B1%E8%A1%8C%E4%BA%86&preview=true)
%E7%AE%97%E4%BA%862%E8%BE%B9%E5%87%8F%E6%8E%891%E5%8D%B3%E5%8F%AF%EF%BC%8C%E7%AD%94%E6%A1%88%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%AE%97%E5%88%B0%E4%BA%86&preview=true)
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,O3,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define all(__vv__) (__vv__).begin(), (__vv__).end()
#define endl "\n"
#define pai pair<int, int>
#define mk(__x__,__y__) make_pair(__x__,__y__)
#define ms(__x__,__val__) memset(__x__, __val__, sizeof(__x__))
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }
inline void print(ll x, int op = 10) { if (!x) { putchar('0'); if (op) putchar(op); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-'); int cnt = 0; while (tmp > 0) { F[cnt++] = tmp % 10 + '0'; tmp /= 10; } while (cnt > 0)putchar(F[--cnt]); if (op) putchar(op); }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll qpow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans *= a; b >>= 1; a *= a; } return ans; } ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }
inline int lowbit(int x) { return x & (-x); }
const int dir[][2] = { {0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1} };
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
ll n, k, ans;
ll find(ll x) {
ll res = 0;
for (ll i = 2, j; i <= x and i <= k; i = j + 1) {
j = min(x / (x / i), k);
(res += (j - i + 1) % MOD * (x / i) % MOD) %= MOD;
}
return res;
}
int main() {
n = read(), k = read();
ans = find(n) + find(n - 1);
print((ans + n + k - 1) % MOD);
return 0;
}