题目描述
样例
源代码
#include <iostream>
#include <algorithm>
using namespace std;
int judge(int n)
{
if (n % 7 == 0)
{
return 1;
}
while (n)
{
if (n % 10 == 7)
{
return 1;
}
n /= 10;
}
return 0;
}
int main()
{
int n;
cin >> n;
int a[4] = { 0 };
for (int i = 1; i <= n; i++)
{
if (judge(i))
{
n++;
a[(i-1)%4]++;
}
}
for (int i = 0; i < 4; i++)
{
cout << a[i] << endl;
}
return 0;
}
关于这题
用judge判断数是否符合要求
判断这个数 如果要被跳过 那么 就n++
求甲乙丙丁 其实就可以向4取余