Cod sursa(job #131900)

Utilizator razvi9Jurca Razvan razvi9 Data 4 februarie 2008 17:52:05
Problema Order Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<cstdio>
#include<vector>
std::vector<int> a;
std::vector<int>::iterator it;
int n,i,poz,j;
int main()
{
	freopen("order.in","r",stdin);
	freopen("order.out","w",stdout);
	scanf("%d",&n);
	for(i=1;i<=n;i++) a.push_back(i);
	poz=1;
	for(i=1;i<=n;i++){
		poz=(poz+i-1)%(n-i+1);
		printf("%d ",a.at(poz));
		a.erase(a.begin()+poz);}
	fclose(stdout);
	return 0;
}