您的位置:首页 > 其它

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: