题意
又是一道题意模糊的题。到底是中过奖了就不算人头了,还是中过奖再抽到才不算人头呢?好像两个都行,不太清楚。我选的前者理解。
思路
水~
代码
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, loop, start;
cin >> n >> loop >> start;
vector<string> name(n);
for (auto& e : name) cin >> e;
if (start > n) {
cout << "Keep going...\n";
exit(0);
}
map<string, bool> mp;
for (int i = start - 1; i < n; i += loop) {
while (i < n && mp[name[i]]) i++;
if (i == n) break;
cout << name[i] << '\n';
mp[name[i]] = true;
}
return 0;
}
HINT
不定时更新更多题解,Basic Level 全部AC代码,详见 link ! ! !