1069 微博转发抽奖

 水题。考STL-map

#include<iostream>
#include<unordered_map>
using namespace std;

string str[1010];
unordered_map<string,bool> mp;
int main() {
    int m,n,s;
    cin>>m>>n>>s;
    for(int i = 1; i <= m; ++i)
        cin>>str[i];
    if(s > m) cout<<"Keep going..."<<endl;
    else {
        for(int i = s; i <= m; i += n) {
            while(i <= m && mp[str[i]] == true) {
                ++i;
            };
            if(i <= m) {
                mp[str[i]] = true;
                 cout<<str[i]<<endl;
            }
        }
    }
    return 0;
}

 

posted @ 2020-02-24 12:45  tangq123  阅读(166)  评论(0编辑  收藏  举报