1069. 微博转发抽奖(20)
#include <iostream>#include <string>#include <map>#include <vector>using namespace std;int main(){ int m,n,s,i=1; vector<string> v; map<string,int> ml; bool iso=false; cin>>m>>n>>s; string str; string ans=""; for(int i=0;i<m;++i) { cin>>str; v.push_back(str); ml[str]=0; } --s;i=s; while(i<m) { if(i==s) { if(ml[v[i]]==0){ ans+=v[i]+"/n"; ml[v[i]]=1; iso=true; } else{ ++i; while(i<m&&ml[v[i]]) ++i; s=i; if(i>=m)break; ans+=v[i]+"/n"; ml[v[i]]=1; iso=true; } s+=n; } ++i; } iso?cout<<ans:cout<<"Keep going...";}新闻热点
疑难解答