ac

1234 · 发布于 2026-01-28 · 浏览 219 回复 0

include<bits/stdc++.h>

using namespace std; const int MAXN=1000000; bool book[MAXN]={false}; int main(){ int n; cin>>n; vectora={1}; book [1]=true; for(int k=2;k<=n;++k) { int g=a.back()-k; if(g<=0||book[g])g=a.back()+k; a.push_back(g); book[g]=true; } sort (a.begin(),a.end()); for (int x:a) cout<<x<< " "; return 0; }

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复