Codeforces Round #655 (Div. 2) A. Omkar and Completion

题目链接:https://codeforces.com/contest/1372/problem/A

题意

构造一个大小为 $n$ 的数组 $a$,要求满足 $1 le a_i le n$,且不存在 $a_x + a_y eq a_z$ 。

题解

最好想的就是全部构造成相等的元素。

代码

#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n; cin >> n;
    for (int i = 0; i < n; i++)
        cout << 1 << " 
"[i == n - 1];
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}
原文地址:https://www.cnblogs.com/Kanoon/p/13289804.html