随笔分类 -  构造

摘要:B. Make Array Good https://codeforces.com/problemset/problem/1762/B 思路 将不是2n(n>0)的数构造成最小的一个大于a[i]2n, 证明: $$ a[i]_{new} = 2^n = a[i] + x(0 \le 阅读全文
posted @ 2023-03-20 17:29 Keith- 阅读(24) 评论(0) 推荐(0) 编辑
摘要:构造字符串 给定一个整数 n,请你构造一个长度为 n 的字符串,要求: 字符串中不含 a,b,c 以外的字符。 字符串中不含长度为 3 的回文子串。 字符串中 c 的数量尽可能少(最好没有)。 输入格式 一个整数 n。 输出格式 一个满足条件的字符串。 如果答案不唯一,则输出任意合理方案均可。 数据 阅读全文
posted @ 2023-03-08 22:18 Keith- 阅读(37) 评论(0) 推荐(0) 编辑
摘要:I. Idiotic Suffix Array 原题链接 题意 构造出一个长度为n只由小写字母组成且首位字符的后缀串在字典序中排第k的字符串 baaa...aa(k-1)cc...ccc(n-k) 代码 点击查看代码 #include<iostream> #include<cstdio> #incl 阅读全文
posted @ 2023-03-08 11:39 Keith- 阅读(18) 评论(0) 推荐(0) 编辑
摘要:C 阿宁的大背包 原题链接 代码 点击查看代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> usi 阅读全文
posted @ 2023-02-04 11:35 Keith- 阅读(34) 评论(0) 推荐(0) 编辑
摘要:B 清楚姐姐学构造 原题链接 题意 给出三个同余式子,分类讨论 思路 $$ \left{ \begin{array}{} a_i \equiv a_{N-1-i}\ (mod\ m) & \ b_i \equiv -b_{N-1-i}\ (mod\ m) &\ c_i \equiv a_i + b_ 阅读全文
posted @ 2023-02-01 21:35 Keith- 阅读(36) 评论(0) 推荐(0) 编辑
摘要:M 清楚姐姐的三角形II 原题链接 题意 构造出一个序列使得每三项都不能构成一个三角形 注意数据范围 注意如果直接看实例递推菲契那波数列的爆范围 构造方法 112112112...//反复输出菲契那波数列前3项 //下标是3的倍数是为2 点击查看代码 #include<iostream> #incl 阅读全文
posted @ 2023-01-31 20:22 Keith- 阅读(26) 评论(0) 推荐(0) 编辑
摘要:C 忽远忽近的距离 原题链接 题意 1。构造一个长度为n的排列,使得满足对于每个ai,有2|aii|3 思路1(dfs枚举) 对于每个ai都有 当ai>ii+2aii+3ai<i 时$ i-3\le a_i\le i-2 阅读全文
posted @ 2023-01-21 09:01 Keith- 阅读(35) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示