Codeforces Round #655 (Div. 2) A. Omkar and Completion(构造)
You have been blessed as a child of Omkar. To express your gratitude, please solve this problem for Omkar!
An array aa of length nn is called complete if all elements are positive and don't exceed 10001000 , and for all indices xx ,yy ,zz (1≤x,y,z≤n1≤x,y,z≤n ), ax+ay≠azax+ay≠az (not necessarily distinct).
You are given one integer nn . Please find any complete array of length nn . It is guaranteed that under given constraints such array exists.
Input
Each test contains multiple test cases. The first line contains tt (1≤t≤10001≤t≤1000 ) — the number of test cases. Description of the test cases follows.
The only line of each test case contains one integer nn (1≤n≤10001≤n≤1000 ).
It is guaranteed that the sum of nn over all test cases does not exceed 10001000 .
Output
For each test case, print a complete array on a single line. All elements have to be integers between 11 and 10001000 and for all indices xx ,yy ,zz (1≤x,y,z≤n1≤x,y,z≤n ) (not necessarily distinct), ax+ay≠azax+ay≠az must hold.
If multiple solutions exist, you may print any.
Example
Input
Copy
2
5
4
Output
Copy
1 5 3 77 12
384 384 44 44
构造一下,1 3 1 3 1 3…这样即可。
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; for(int i = 1; i <= n; i++) { if(i & 1) cout << 1 << ' '; else cout << 3 << ' '; } cout << endl; } return 0; }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!