1069 微博转发抽奖

题目传送门

#include <iostream>
#include <map>
using namespace std;
int main()
{
	int m, n, s;
	cin >> m >> n >> s;
	string str;
	map<string, int> ma;
	int flag = 0;
	for (int i = 1; i <= m; i++)
	{
		cin >> str;
		if (ma[str])
		{
			s++;
		}
		if (s == i && ma[str] == 0)
		{
			ma[str] = 1;
			cout << str << endl;
			flag = 1;
			s += n;
		}
	}
	if (!flag)
	{
		cout << "Keep going...";
	}
	return 0;
}
上一篇:模板 - 字符串 - Manacher


下一篇:杭电1003题