问题描述
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/59a4c8ed15cbe53f56c00204ba31c17d.png)
思路
完整代码
#include<iostream>
using namespace std;
int is_skip( int a )
{
int b;
if( a%7 == 0 )
return 1;
else
{
while( a >= 1 )
{
b = a%10;
if( b == 7 )
return 1;
a = a/10;
}
}
return 0;
}
int main()
{
int n;
cin >> n;
int counter = 0;
int all = 0;
int skip_num[4] = {0};
while( counter < n )
{
all++;
if(is_skip(all))
{
int tmp = all%4;
skip_num[tmp]++;
continue;
}
counter++;
}
cout << skip_num[1]<< endl;
cout << skip_num[2]<< endl;
cout << skip_num[3]<< endl;
cout << skip_num[0]<< endl;
return 0;
}
提交截图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/600db9666f24e294780c6190ab629453.png)