# 第十四届蓝桥杯三月真题刷题训练——第 10 天（3.13）

Cauchy 2023-03-13 21:07:02
int n, m;

void solve() {
// cout << 20 * 21 + 4;
// cout << 19 * 22 + 4 << endl;
cout << 4 + 440 - 1 << endl;
}
int n, m;

void out_Int(Int x) {
string s = "";
while (x) {
s += x % 10 + '0';
x /= 10;
}
for (int i = s.sz - 1; i >= 0; i--) cout << s[i];
}

void solve() {
Int res = 0;
int aa, bb, nn; cin >> aa >> bb >> nn;
Int a = aa, b = bb, n = nn;
Int week = 5 * a + 2 * b;
res += n / week * 7;
n -= n / week * week;
for (int i = 0; i < 7; i++) {
if (n > 0) res++;
else break;
if (i < 5) n -= a;
else n -= b;
}
// cout << res << endl;
out_Int(res);
}
void solve() {
int n; cin >> n;
for (int i = 1; i <= n; i++) {
cout << max((i - 1) * 2, (n - i) * 2) << endl;
}
}
int f[N];

void solve() {
int n, k; cin >> n >> k;
int a[n + 1]{};
int s[n + 1]{};
for (int i = 1; i <= n; i++) cin >> a[i], a[i] %= k;
for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i], s[i] %= k, f[s[i]]++;

int res = 0;
for (int i = n; i >= 1; i--) {
res += f[s[i]];
if (s[i]) res -= 1;
f[s[i]] -= 1;
}
cout << res << endl;
}

...全文
2 回复 打赏 收藏 举报

3.1w+

2023-03-13 21:07

刷题！