1124 Raffle for Weibo Followers

英文版题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805350803292160

中文版题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805265159798784

 1 #include<iostream>
 2 #include<vector>
 3 #include<unordered_map>
 4 using namespace std;
 5 
 6 
 7 int main() {
 8     int m,n,s;
 9     cin>>m>>n>>s;
10     vector<string> vs(m+1);
11     unordered_map<string,bool> mp;
12     for(int i = 1; i <= m; ++i) {
13         cin>>vs[i];
14         mp[vs[i]] = false;
15     }
16     if(s > m) printf("Keep going...");
17     else {
18         while(s <= m) {
19             while(s <= m&&mp[vs[s]])
20                 s++;
21             if(s <= m) {
22                 mp[vs[s]] = true;
23                 printf("%s\n",vs[s].c_str());
24                 s += n;
25             }
26         }
27     }
28     return 0;
29 }

 

posted @ 2020-03-18 16:46  tangq123  阅读(155)  评论(0)    收藏  举报