Codeforces Round #758 (Div.1 + Div. 2)

编程入门 行业动态 更新时间:2024-10-27 06:26:27

<a href=https://www.elefans.com/category/jswz/34/1770097.html style=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)

本文发布于:2024-02-26 04:58:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1701421.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Codeforces   Div

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!