源代码
#include <iostream>
#include <string>
using namespace std;
int Judge(int counter) {
char buff[10];
_itoa(counter, buff, 10);//将整数转成字符串
string str = buff;
return str.find('7');
}
int main()
{
int n;
int counter = 0;
int player[4] = { 0 };
cin >> n;
while (n > 0) {
counter++;
if (counter % 7 == 0 || Judge(counter) != -1) {
player[(counter - 1) % 4]++;
}
else {
n--;
}
}
for (int i = 0; i < 4; i++) {
cout << player[i] << endl;
}
}