我的个人网站 Cheese的个人主页http://www.cheese.ren/
博客来源 PAT 乙级 1069 微博转发抽奖-Cheese的个人博客PAT 乙级 1069 微博转发抽奖http://blog.cheese.ren/89
欢迎交换友链 :-)
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, s;
cin >> m >> n >> s;
string username[m];
string is_prize[m];
int is_prize_count=0;
for (int i=0; i<m; i++)
cin >> username[i];
bool anyone_win = false;
for (int i=s-1; i<m; ) {
bool is_repeated=false;
// inspect if any username repeats
for (int l=0; l<is_prize_count; l++) {
if (username[i] == is_prize[l]) {
i++;
is_repeated = true;
break;
}
}
if (!is_repeated) {
cout << username[i] << endl;
is_prize[is_prize_count++] = username[i];
anyone_win = true;
i += n;
}
}
if (!anyone_win)
printf("Keep going...\n");
return 0;
}