| ||||||||||
| 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 | |||||||||
终于AC了!WA了好几次,原来数组开小了#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,k,p,a[100005],b[60000];
int i,j,m,temp,ds;
cin>>n>>k>>p;
i=1;j=0;temp=0;ds=1;
m=k/n;
for(i=1;i<=k;i++)
a[i]=i;
a[0]=0;a[1]=0;
for(i=2;j<m;i++){
if(a[i]){
temp++;
if(temp==p+1){
temp=0;
ds++;
if(ds==n){
b[j]=a[i];j++;
ds=0;
}
a[i]=0;
}
}
if(i==k)
i=1;
}
sort(b,b+m);
for(j=0;j<m;j++)
cout<<b[j]<<endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator