#include <iostream>
using namespace std;
int main()
{int i,n;
while(cin>>n)
{if(n==0||n==1) cout<<0;
if(n==2) cout<<"0 1";
if(n==3) cout<<"0 2 3";
if(n>3){
cout<<"0 "<<n-1<<" ";
for(i=2*(n-2);i<=n*(n-1)/2;i++)
cout<<i<<" ";
}
cout<<endl;
}
return 0;
}
转载于:https://www.cnblogs.com/NYNU-ACM/p/4658249.html
本文介绍了一段使用C++编写的代码,该代码能够根据输入的整数n,按照特定规则打印一系列数字。具体实现包括判断n的大小,并根据不同情况输出相应的数字序列,对于大于3的n,程序将输出从0到n-1的数字序列,再按特定公式生成后续数字。
4359

被折叠的 条评论
为什么被折叠?



