题解归档 - cf2231A
本文最后由方少年更新于2026 年 6 月 28 日,已超过0天没有更新。如果文章内容或图片资源失效,请留言反馈,将会及时处理,谢谢!
题解归档 - cf2231A
本文由 cf-code 本地题解库自动归档;公开内容以本地 AC/验证版本为准。
- 本地编号:
cf2231A - 本地来源:
problems/cf2231A/idea.md - 题目链接:https://codeforces.com/contest/2231/problem/A
- 原始标题:cf2231A Construct an Array
思路
cf2231A Construct an Array
思路
输出 n+1,n+2,...,2n。
元素本身两两不同,相邻和为 2n+3,2n+5,...,4n-1,也两两不同,并且所有相邻和都大于 2n,不会和元素撞。
验证
python tools/run_exe.py cf2231A编译并运行样例,输出为合法构造。
代码
来源:problems/cf2231A/solution.cpp
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll t,n,i;
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
for(i=1;i<=n;i++) printf("%lld%c",n+i,i==n?'\n':' ');
}
return 0;
}
~ ~ The End ~ ~
文章标题:题解归档 - cf2231A
文章链接:https://www.fangshaonian.cn/archives/276/
最后编辑:2026 年 6 月 28 日 19:06 By 方少年
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)