上一页 1 2 3 4 5 6 ··· 14 下一页
摘要: B. Make Array Good https://codeforces.com/problemset/problem/1762/B 思路 将不是$2^n(n>0)$的数构造成最小的一个大于$a[i]$的$2^n$, 证明: $$ a[i]_{new} = 2^n = a[i] + x(0 \le 阅读全文
posted @ 2023-03-20 17:29 Keith- 阅读(21) 评论(0) 推荐(0) 编辑
摘要: D. XOR Permutations 注意 多次输入输出不要忘了初始化 注意分析 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include 阅读全文
posted @ 2023-03-15 18:28 Keith- 阅读(12) 评论(0) 推荐(0) 编辑
摘要: A. K-divisible Sum 思路 $$ ans = \left \lceil \frac{kx}{n} \right \rceil $$ $$ x = x_{min} \ge \left \lceil \frac{n}{k} \right \rceil $$ 代码 点击查看代码 #incl 阅读全文
posted @ 2023-03-13 13:38 Keith- 阅读(13) 评论(0) 推荐(0) 编辑
摘要: B. Ideal Point 思路 首先删除不包含点k的线段,因为这些线段对使$f(k) > f(x)$没有贡献 然后再考虑剩余的线段中覆盖得到的f(x)最大值是否唯一(由于前面的处理,所有线段均包含点k,如果最大值唯一的话,那么只能是k点),如果最大值不唯一的话就无论如何删除线段也无法满足要求(由 阅读全文
posted @ 2023-03-13 12:13 Keith- 阅读(19) 评论(0) 推荐(0) 编辑
摘要: A. QAQ 法1 由于数据范围比较小,可以三层循环求解 法2 每一个A的下标存到数组v中,开个cnt数组记录每个位置前面有多少个'Q',利用前缀和可以求得范围内'Q'的数量 $$ ans = \sum_{i = 0}^{v.size()-1} cnt[i - 1] × (cnt[n] - cnt[ 阅读全文
posted @ 2023-03-11 11:38 Keith- 阅读(20) 评论(0) 推荐(0) 编辑
摘要: A. Stone Game 代码 点击查看代码 #include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int t; cin >> t; while(t -- ){ int n; 阅读全文
posted @ 2023-03-11 10:41 Keith- 阅读(12) 评论(0) 推荐(0) 编辑
摘要: GDUT 2022 grade Qualifying # 3总结 A. Takeaway 模拟 B. Easy Math Problem https://codeforces.com/group/jv8nZnsO6t/contest/431471/problem/B 找规律,比赛时以为是数论题怎么也 阅读全文
posted @ 2023-03-11 00:05 Keith- 阅读(18) 评论(0) 推荐(0) 编辑
摘要: A. Computer Game 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> 阅读全文
posted @ 2023-03-10 23:41 Keith- 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 字符串的展开 在初赛普及组的“阅读程序写结果”的问题中,我们曾给出一个字符串展开的例子: 如果在输入的字符串中,含有类似于 d-h 或 4-8 的子串,我们就把它当作一种简写,输出时,用连续递增的字母或数字串替代其中的减号,即,将上面两个子串分别输出为 defgh 和 45678。 在本题中,我们通 阅读全文
posted @ 2023-03-09 17:47 Keith- 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 把数字翻译成字符串 给定一个数字,我们按照如下规则把它翻译为字符串: 0 翻译成 a,1 翻译成 b,……,11 翻译成 l,……,25 翻译成 z。 一个数字可能有多个翻译。 例如 12258 有 5 种不同的翻译,它们分别是 bccfi、bwfi、bczi、mcfi 和 mzi。 请编程实现一个 阅读全文
posted @ 2023-03-09 10:52 Keith- 阅读(28) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 14 下一页