You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
/**
* 77
* @param t
* @return
*/
bool IncludeSeven(int t) {
if (t % 7 == 0) return true;
//数位分离
while (t) {
int c = t % 10;
if (c == 7) return true;
t /= 10;
}
return false;
}
int main() {
//调试非常重要,这一个技能糖豆一定要熟练掌握。
//输入+输出重定向
freopen("../1380.in", "r", stdin);
freopen("../1380.out", "w", stdout);
int n, m, t;
cin >> n >> m >> t;
vector<string> v1;
for (int i = 0; i < n; ++i) {
string name;
cin >> name;
v1.push_back(name);
}
//第m个人--->在数组中就是m-1号索引
int index = m - 1;
while (v1.size() > 1) {
t++;
index++;
//如果到达最后一个后还在增加,那么回到数组的开头位置
if (index == v1.size()) index = 0;
//如果包含7或者是7的倍数那么需要删除
if (IncludeSeven(t)) {
//删除对应的index位置的数据
v1.erase(v1.begin() + index);
//还回一个位置
index--;
}
}
cout << v1[0] << endl;
//关闭文件
fclose(stdin);
fclose(stdout);
return 0;
}