题解:
#include<bits/stdc++.h>
using namespace std;
int n;
bool shouldSkip(int num)
{
if (num % 7 == 0)
{
return true;
}
while (num > 0)
{
if (num % 10 == 7)
{
return true;
}
num /= 10;
}
return false;
}
int main()
{
scanf("%d", &n);
int b[4] = { 0 };//用于记录四个人被跳过的次数
for (int i = 1; i <= n; i++)
{
int current_person = (i - 1) % 4;
if (shouldSkip(i))
{
b[current_person]++;
n += 1;
}
}
for (int i = 0; i < 4; i++)
{
cout << b[i] << endl;
}
return 0;
}