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; }