Codeforces Round #758 (Div.1 + Div. 2)"/>
Codeforces Round #758 (Div.1 + Div. 2)
A. Find Array
题意:
给一个数字 n n n要求寻找出一个长为 n n n的数组 a a a,保证:
- 1 ≤ a i ≤ 1 0 9 1\le a_i \le 10^9 1≤ai≤109
- a 1 < a 2 < ⋯ < a n a_1<a_2<\dots<a_n a1<a2<⋯<an
- 对于 i ≥ 2 i\ge 2 i≥2, a i a_i ai不可以被 a i − 1 a_{i-1} ai−1整除
分析:
直接返回 2 2 2到 n + 1 n+1 n+1即可
代码:
#include<bits/stdc++.h>
using namespace std;int main()
{ios::sync_with_stdio(0);int T;cin>>T;while (T--){int n;cin>>n;for (int i=1;i<=n;++i)cout<<i+1<<" ";cout<<endl;}
}
B. Build the Permutation
题意:
构造一个 1 1 1到 n n n的排列,要求有 a a a个山顶, b b b个山谷
对 n − 1 ≥ i ≥ 2 n-1\ge i\ge 2 n−1≥i≥2 如果
- a i a_i a
更多推荐
Codeforces Round #758 (Div.1 + Div. 2)
发布评论