Codeforces Round 824 (Div. 2) 解题报告
对应场次为 CF1735
A. Working Week
题目大意
你接下来有
设你工作的三段长度为
求
Solution
懒得打
点击查看代码
#include <bits/stdc++.h>
#define ll long long
using namespace std;
inline int read() {
int xr = 0, F = 1;
char cr;
while (cr = getchar(), cr < '0' || cr > '9') if (cr == '-') F = -1;
while (cr >= '0' && cr <= '9')
xr = (xr << 3) + (xr << 1) + (cr ^ 48), cr = getchar();
return xr * F;
}
void write(ll x) {
char ws[51];
int wt = 0;
if (x < 0) putchar('-'), x = -x;
do {
ws[++wt] = x % 10 + '0';
x /= 10;
} while (x);
for (int i = wt; i; --i) putchar(ws[i]);
}
namespace steven24 {
int T, n;
void main() {
T = read();
while (T--) {
n = read();
write((n - 3) / 3 - 1), putchar('\n');
}
}
}
int main() {
steven24::main();
return 0;
}
B. Tea with Tangerines
tangerine 橘子
题目大意
给定
Solution
通过观察样例解释不难发现最小的那个数一定是不要裂开的
然后就可以把最小数的二倍作为基准去劈其它的数
发现比较均匀地劈一定是最优的 因为这样会让劈开的几段中最长的最短
点击查看代码
#include <bits/stdc++.h>
#define ll long long
using namespace std;
inline int read() {
ll xr = 0, F = 1;
char cr;
while (cr = getchar(), cr < '0' || cr > '9') if (cr == '-') F = -1;
while (cr >= '0' && cr <= '9')
xr = (xr << 3) + (xr << 1) + (cr ^ 48), cr = getchar();
return xr * F;
}
void write(ll x) {
char ws[51];
int wt = 0;
if (x < 0) putchar('-'), x = -x;
do {
ws[++wt] = x % 10 + '0';
x /= 10;
} while (x);
for (int i = wt; i; --i) putchar(ws[i]);
}
namespace steven24 {
const int N = 521;
int a[N];
int T, n;
void main() {
T = read();
while (T--) {
n = read();
for (int i = 1; i <= n; ++i) a[i] = read();
int minn = *min_element(a + 1, a + 1 + n);
minn <<= 1;
--minn;
int ans = 0;
for (int i = 1; i <= n; ++i) {
if (a[i] > minn) {
ans += a[i] / minn - 1;
if (a[i] % minn) ++ans;
}
}
write(ans), putchar('\n');
}
}
}
int main() {
steven24::main();
return 0;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧