(顺序表的应用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; }
相关文章推荐
- (顺序表的应用5.4.3)POJ 1012(约瑟夫环问题——保证前k个出队元素为后k个元素)
- (顺序表的应用5.4.2)POJ 1591 M*A*S*H(约瑟夫环问题的变形——变换步长值)
- (顺序表应用5.1.1)POJ 3750 小孩报数问题(基本的约瑟夫环问题:给出人数n,出发位置w,间隔数s)
- (顺序表应用5.1.1)POJ 3750 小孩报数问题(基本的约瑟夫环问题:给出人数n,出发位置w,间隔数s)
- (顺序表的应用5.4.2)POJ 1591 M*A*S*H(约瑟夫环问题的变形——变换步长值)
- 约瑟夫环问题 poj 1012 && poj 2244
- (顺序表应用5.1.2)UVA 113 The Dole Queue(双向约瑟夫环问题:给出总人数n,顺时针数k个,逆时针数m个)
- 数据结构(4)--循环链表的应用之约瑟夫环问题以及线性表总结之顺序表与链表的比较
- NYOJ 191 && POJ 1012 Joseph(约瑟夫环问题)
- NYOJ 191 && POJ 1012 Joseph(约瑟夫环问题)
- 顺序队列的创建、初始化、判断空、入队、出队、读取队头元素、置空、求队长操作
- 顺序表应用1:多余元素删除之移位算法
- 顺序表应用4:元素位置互换之逆置算法
- collections 排序问题 (在应用ztree时顺序每次加载都不一样)
- 顺序表应用4:元素位置互换之逆置算法
- 约瑟夫环问题---n个人,没弟k个剔除,最后一个元素是多少
- POJ 1696 Space Ant 类似凸包问题(叉积的应用)
- 约瑟夫问题 算法很简单保证每个人都能看懂用的是模拟现实 用数组实现 利用循环删除数组中的元素
- 顺序表的应用(删除链表重复元素)
- 顺序表应用3:元素位置互换之移位算法