poj3750 小孩报数问题
2017-04-09 13:25
417 查看
题目链接:http://poj.org/problem?id=3750
题意:中文题
解析:数据小,开数组直接模拟
题意:中文题
解析:数据小,开数组直接模拟
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <cstring> #include <queue> #include <cmath> #include <map> using namespace std; const int maxn = 1e6+100; const int inf = 0x7ffffff; int vis[100]; int main(void) { string a[100]; int n; scanf("%d",&n); int tmp = n; for(int i=0;i<n;i++) cin>>a[i]; int w,s; scanf("%d,%d",&w,&s); w--; int tt = 0; while(tmp) { while(vis[w]) w = (w+1)%n; tt++; if(tt==s) { vis[w] = 1; tt = 0; cout<<a[w]<<endl; tmp--; } w = (w+1)%n; } return 0; }
相关文章推荐
- POJ3750: 小孩报数问题+一道经典约瑟夫问题(猴子选大王)
- 北京大学ACM---poj3750---小孩报数问题(循环链表求解法)
- poj3750 小孩报数问题
- poj3750 小孩报数问题
- poj3750-小孩报数问题(约瑟夫环)
- POJ3750_小孩报数问题【约瑟夫环】【string】【list】
- poj 3750 小孩报数问题
- pku 3750 小孩报数问题 解题报告
- (顺序表应用5.1.1)POJ 3750 小孩报数问题(基本的约瑟夫环问题:给出人数n,出发位置w,间隔数s)
- poj 3750 小孩报数问题
- poj 3750 小孩报数问题
- Poj 3750 小孩报数问题
- POJ 3750 小孩报数问题
- poj 3750 小孩报数问题
- 小孩报数问题
- poj 3750 小孩报数问题(模拟)
- POJ 3750 小孩报数问题
- poj 3750 小孩报数问题
- poj 3750 小孩报数问题 (约瑟夫问题)
- 北大ACM poj3750 小孩报数问题