poj3629

//(队列)poj3629
/*
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

#define MAXN 100005
int ans[MAXN];
int main(int argc, char *argv[])
{
	long N,K,M,P;
	long i,j,count;
	count=0;
	queue<long>q;
	cin>>N>>K>>P;
	for(i=1;i<=K;i++) q.push(i);
	while(!q.empty()){
		for(i=1;i<=N;i++){
			//cout<<"??";
			if(i==N) {ans[count++]=q.front();}
			q.pop();
			for(j=1;j<=P;j++){
				q.push(q.front());
				q.pop();
			}
		}

	}
	sort(ans,ans+count);
	for(i=0;i<count;i++) cout<<ans[i]<<endl;

	return 0;
}
//*/

  

posted @ 2015-04-19 23:52  PaigeWw  阅读(255)  评论(0编辑  收藏  举报