比赛链接:Here

A - Arithmetic Sequence (good)

注意细节

int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll a, b, c;
cin >> a >> b >> c;
ll x = 2 * b - a - c;
ll k = (x >= 0 ? 0 : (1 - x) / 2);
ll ans = x + 3 * k;
cout << ans << endl;
}

B - Increasing Triples (good)

大根堆优先队列

using PQ = priority_queue<int, vector<int>, greater<int>>;

int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n; PQ A, B, C;
for (int i = 0, x; i < n; ++i) {cin >> x; A.push(x);}
for (int i = 0, x; i < n; ++i) {cin >> x; B.push(x);}
for (int i = 0, x; i < n; ++i) {cin >> x; C.push(x);} int a, b;
int ans = 0;
while (!A.empty()) {
a = A.top(); A.pop(); while (!B.empty() and B.top() <= a)B.pop();
if (B.empty() )break;
b = B.top(); B.pop(); while (!C.empty() and C.top() <= b)C.pop();
if (C.empty()) break;
C.pop(); ++ans;
}
cout << ans ;
}

C - 1, 2, 3 - Decomposition (good)

给你一个数,让你分解成不含0的四进制之和,求最少分解成多少个?


从高位到低位思考,每一位有两种情况,一种借一给低位,另一种不借。含高位构造数数目小于等于含低位的构造数数目.

int solve(ll n) {
if (n == 0)return 0;
if (n < 10)return (n - 1) / 3 + 1;
ll mi = 0;
ll pi = n, pa, pb;
pb = solve(pi / 10 - 1);
pa = solve(pi / 10);
if (pa > pi % 10)return max(pb, (pi % 10 + 10 - 1) / 3 + 1);
return min(max(pa, (pi % 10 - 1) / 3 + 1), max(pb, (pi % 10 + 10 - 1) / 3 + 1));
} int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int _; for (cin >> _; _--;) {
ll n; cin >> n;
cout << solve(n) << '\n';
}
}

AtCoder Regular Contest 123 (A~C 三道好题)的更多相关文章

  1. Atcoder Regular Contest 123 题解

    u1s1 我是真的不知道为什么现场这么多人切了 D,感觉 D 对思维要求显然要高于其他 300+ 人切掉的 D 吧(也有可能是 Atc 用户整体水平提升了?) A 开 幕 雷 击(这题似乎 wjz 交 ...

  2. AtCoder Regular Contest 061

    AtCoder Regular Contest 061 C.Many Formulas 题意 给长度不超过\(10\)且由\(0\)到\(9\)数字组成的串S. 可以在两数字间放\(+\)号. 求所有 ...

  3. AtCoder Regular Contest 094 (ARC094) CDE题解

    原文链接http://www.cnblogs.com/zhouzhendong/p/8735114.html $AtCoder\ Regular\ Contest\ 094(ARC094)\ CDE$ ...

  4. AtCoder Regular Contest 094

    AtCoder Regular Contest 094 C - Same Integers 题意: 给定\(a,b,c\)三个数,可以进行两个操作:1.把一个数+2:2.把任意两个数+1.求最少需要几 ...

  5. AtCoder Regular Contest 102

    AtCoder Regular Contest 102 C - Triangular Relationship 题意: 给出n,k求有多少个不大于n的三元组,使其中两两数字的和都是k的倍数,数字可以重 ...

  6. AtCoder Regular Contest 096

    AtCoder Regular Contest 096 C - Many Medians 题意: 有A,B两种匹萨和三种购买方案,买一个A,买一个B,买半个A和半个B,花费分别为a,b,c. 求买X个 ...

  7. AtCoder Regular Contest 092

    AtCoder Regular Contest 092 C - 2D Plane 2N Points 题意: 二维平面上给了\(2N\)个点,其中\(N\)个是\(A\)类点,\(N\)个是\(B\) ...

  8. AtCoder Regular Contest 093

    AtCoder Regular Contest 093 C - Traveling Plan 题意: 给定n个点,求出删去i号点时,按顺序从起点到一号点走到n号点最后回到起点所走的路程是多少. \(n ...

  9. AtCoder Regular Contest 095

    AtCoder Regular Contest 095 C - Many Medians 题意: 给出n个数,求出去掉第i个数之后所有数的中位数,保证n是偶数. \(n\le 200000\) 分析: ...

  10. AtCoder Regular Contest 097

    AtCoder Regular Contest 097 C - K-th Substring 题意: 求一个长度小于等于5000的字符串的第K小子串,相同子串算一个. K<=5. 分析: 一眼看 ...

随机推荐

  1. MySQL - Plugin 'InnoDB' registration as a STORAGE ENGINE failed 错误处理

    版权声明:原创作品,谢绝转载!否则将追究法律责任. ----- 作者:kirin Plugin 'InnoDB' registration as a STORAGE ENGINE failed,从详细 ...

  2. 金蝶云星空与吉客云电商ERP数据对接

    01 系统说明: 吉客云 吉客云: 从业务数字化和组织数字化两个方向出发,以生成流程的闭环为依归,致力于为企业的数字化升级提供落地工具.销售订单层面,吉客云对接了国内外主流的销售平台,兼容了电商渠道. ...

  3. 每日总结9.20-phoenix的连接

    今天连了phoenix 出现了好多问题,欸 一点点解决,看那个电脑我头都要晕了,jar包和xml文件的问题,总之是解决了 怎么办,我还不会springboot,好多人都学了,我害怕.大家怎么都这么努力 ...

  4. C++学习笔记七:输出格式<ios><iomanip>

    这一篇主要总结一下C++标准库里输出格式相关的库函数. https://en.cppreference.com/w/cpp/io/manip 1.库: <ostream> <ios& ...

  5. Gradle导致Lombok不生效问题

    现象 从debug看是可以查询到数据的,但是返回起前端是没有数据的 解决办法 // 引入lombok注解处理器 annotationProcessor,不然lombok不会生效 annotationP ...

  6. 华企盾DSC无缝替换其它加密软件两种方法

    有源码和大型图纸的使用第一种方案 第一种: 1.把DSCClient.exe和DSCService.exe添加到竞品的加密软件进程中,配置允许打开加密文件,加密类型不加密 2.安装DSC客户端后扫描加 ...

  7. MinIO客户端之share

    MinIO提供了一个命令行程序mc用于协助用户完成日常的维护.管理类工作. 官方资料 mc share mc share download mc share upload 生成下载对象的URL,指定对 ...

  8. Typora远程代码执行漏洞 - CVE-2023-2317

    Typora - CVE-2023-2317 简介 Typora一个常用的markdown编辑器,在1.6.7之前存在XSS漏洞,可以通过传入参数触发来加载恶意的JavaScript代码 分析 在ty ...

  9. VisionPro学习笔记(6)——如何使用QuickBuild

    如果需要了解其他图像处理的文章,请移步小编的GitHub地址 传送门:请点击我 如果点击有误:https://github.com/LeBron-Jian/ComputerVisionPractice ...

  10. reboot详解

    linux下reboot命令详解 linux reboot 命令详解 功能说明:重新开机. 语 法:dreboot [-dfinw] 补充说明:执行reboot指令可让系统停止运作,并重新开机. 参 ...