首页 > 其他 > 详细

1069 微博转发抽奖 (20 分)

时间:2019-05-01 10:09:27      阅读:150      评论:0      收藏:0      [点我收藏+]
#include <iostream>
#include <set>
#include <string>
using namespace std;
set<string>ss;  
void tmp() {
    int n, m, t;
    cin >> t >> n >> m;
    for (int i = 1; i <= t; i++) {
        string s;
        cin >> s;
        if (i == m && ss.count(s) == 0) {   // count() 用来查找set中某个某个键值出现的次数
            cout << s << endl; 
            ss.insert(s);
            m += n;
        }
        else if (i == m && ss.count(s) != 0) {   // 如果当前的重复了就往后遍历
            m++;
        }
    }
    if (ss.empty()) {   // 如果set容器为空就是代表没有
        cout << "Keep going..." << endl;
    }
}
int main() {
    tmp();
    return 0;
}

 

1069 微博转发抽奖 (20 分)

原文:https://www.cnblogs.com/Hk456/p/10798876.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!