-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1069.cpp
More file actions
47 lines (40 loc) · 694 Bytes
/
Copy path1069.cpp
File metadata and controls
47 lines (40 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
int m, n, s,a;
cin >> m >> n >> s;
vector<string> temp;
a = s;//备份s
for (int i = 1; i <= m; i++)
{
string ss;
cin >> ss;
int flag = 0;
for (int j = 0; j < temp.size(); j++)//之前这个人已经中过奖了
{
if (temp[j] == ss)
{
flag = 1;
break;
}
}
if (i == s && !flag)//抽中的这个人之前也没中过奖
{
temp.push_back(ss);
s += n;//中奖间隔为n
}
else if (i == s && flag)//抽中的这个人之前中过奖
s++;
}
if (m < a)//没有人中奖
cout << "Keep going..." << endl;
else
{
for (int i = 0; i < temp.size(); i++)
cout << temp[i] << endl;
}
return 0;
}