0
点赞
收藏
分享

微信扫一扫

(顺序表的应用5.4.3)POJ 1012(约瑟夫环问题——保证前k个出队元素为后k个元素)


/*
 * POJ-1012.cpp
 *
 *  Created on: 2013年10月31日
 *      Author: Administrator
 */


#include <iostream>
#include <cstdio>

using namespace std;

int x[] = { 2, 7, 5, 30, 169, 441, 1872, 7632, 1740, 93313, 459901, 1358657,
	    2504881 };

int main(){
	int n;
	while(scanf("%d",&n)!=EOF,n){
		printf("%d\n",x[n-1]);
	}

	return 0;
}


举报

相关推荐

0 条评论