美文网首页
1124 Raffle for Weibo Followers

1124 Raffle for Weibo Followers

作者: 我非神灵 | 来源:发表于2019-01-28 10:17 被阅读0次
#include<iostream>
#include<stdio.h>
#include<vector>
#include<string>
#include<set>

using namespace std;

set<string> included;
vector<string> winners;

int main()  
{
    int n, k, st;
    scanf("%d%d%d", &n, &k, &st);
    int cur = st;
    for (int i = 1; i <= n; i++)
    {
        string temp;
        cin >> temp;
        if (cur == i)
        {
            if (included.find(temp) == included.end())
            {
                included.insert(temp);
                winners.push_back(temp);
                cur += k;
            }
            else cur++;
        }
    }
    if (winners.empty()) cout << "Keep going...\n";
    else
    {
        for (int i = 0; i < winners.size(); i++)
        {
            cout << winners[i] << endl;
        }
    }
    system("pause");
    return 0;
}

相关文章

网友评论

      本文标题:1124 Raffle for Weibo Followers

      本文链接:https://www.haomeiwen.com/subject/svoojqtx.html