Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:嗯哈,少打了个字,让您贱笑了……In Reply To:喝水到100,留个爪印~~菜鸟一只,让您笑了…… Posted by:wsj19911101 at 2010-11-24 23:42:18 > #include <iostream> > using namespace std; > int a[13]; > int main() > { > int n,m; > cin>>n; > for(int i=1;i<=n;i++) > { > cin>>m; > memset(a,0,sizeof(a)); > int k=2,p=-1; > for(int j=1;j<=m;j++) > { > int n=0; > while(n!=k) > { > p=(p+1)%m; > if(a[p]==0)n++; > } > a[p]=k-1; > k++; > } > for(int j=0;j<m-1;j++)cout<<a[j]<<' '; > cout<<a[m-1]<<endl; > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator