poj 3750
来源:互联网 发布:快速出效果图软件 编辑:程序博客网 时间:2024/06/01 21:39
约瑟夫问题
#include <iostream>#include <cstdio>#include <cstring>const int maxn = 55;const int maxl = 20;using namespace std;char name[maxn][maxl];bool flag[maxn];int main(){ int n; while(~scanf("%d",&n)){ memset(flag,false,sizeof(flag)); for(int i = 0; i < n; ++i) scanf("%s",name[i]); int cnt = 0; int s,m; scanf("%d,%d",&s,&m); s--; while(cnt != n){ int c = 0; while(true){ if(!flag[s%n]) c++; if(c == m) break; s++; } cnt++; flag[s%n] = true; printf("%s\n",name[s%n]); } } return 0;}
- poj 3750
- poj 3750
- POJ 3750
- poj 3750 水题啊。。。。。。
- poj 3750 小孩报数
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- JS中cookie的使用
- 《IT通史》读后感二 —— 大型机的风起云涌
- STM32电源管理与低功耗模式
- android系统广播大全
- HDU1021---Fibonacci Again HDU(134)
- poj 3750
- 数据结构——键树之双链表
- C语言深度解剖读书笔记(1.关键字的秘密)
- 话说MongoDB的存储格式BSON
- oracle 正则表达式
- 树的非递归便利,中序和后序
- Git——git 使用技巧
- Kalido MDM 笔记 3
- c语言库函数大全