#include<bits/stdc++.h>
using namespace std;
int a[4];
bool check(int t)
{
if(t%7==0) return true;
if(t%10==7 || t/10%10==7 || t/100%10==7)
return true;
return false;
}
int main()
{
int n,cnt=1,sum=0;
scanf("%d",&n);
while(cnt-sum<=n)
{
if(check(cnt))
{
int t=(cnt-1)%4;
a[t]++;
sum++;
}
cnt++;
}
for(int i=0;i<4;i++)
printf("%d\n",a[i]);
return 0;
}
csp-报数
最新推荐文章于 2025-07-11 17:05:45 发布
这篇文章介绍了一个名为`check`的函数,用于判断整数是否满足特定条件(除以7余数为0或十位、百位含有7)。程序通过循环和计数器实现,统计满足条件的整数,并将其存储在数组a中。最后输出数组的元素频率。
582

被折叠的 条评论
为什么被折叠?



