您的位置:首页 > 其它

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

2013-11-14 21:05 197 查看
/*
* 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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐