#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
typedef long long int LL;
const int MAX = 1010, INF = 1<<30;
int M, N, S;
string name[MAX];
map<string, bool> flag;//注意不能用map<char*, bool>
int main()
{
scanf("%d %d %d", &M, &N, &S);
for(int i=1; i<=M; i++)
{
cin>>name[i];
flag[name[i]] = 0;
}
if(M < S) cout<<"Keep going..."<<endl;
for(int j=S; j<=M; j+=N)
{
while(j<=M && flag[name[j]]) j++;//已經中過獎了,便考慮下一個
if(j > M) break;
cout<<name[j]<<endl;
flag[name[j]] = 1;//置爲已經中獎
}
return 0;
}
PAT (Advanced Level) Practice A1124 Raffle for Weibo Followers (20 分) (map)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.