思路
代码可能写的有点啰嗦冗余,写的时候有点急写完一节就直接复制粘贴了蛤蛤蛤,所以导致中间有些代码比较重复。
Code
#include<bits/stdc++.h>//模拟
using namespace std;
int n, sum = 0, a, b, c, d;
bool judge(int s)
{
int temp = s;
if (temp % 7 == 0)
return 0;
while (temp >= 1)
{
if (temp % 10 == 7)
return 0;
temp /= 10;
}
return 1;
}
int main()
{
cin >> n;
for (int i=1;1;i++)
{
if (sum == n)
break;
if (judge(i))
sum++;
else
a++;
i++;
if (sum == n)
break;
if (judge(i))
sum++;
else
b++;
if (sum == n)
break;
i++;
if (judge(i))
sum++;
else
c++;
if (sum == n)
break;
i++;
if (judge(i))
sum++;
else
d++;
if (sum == n)
break;
}
cout << a << endl << b << endl << c << endl << d << endl;
return 0;
}