题解 | #挑7# 比较简单
挑7
https://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
#include <stdio.h>
int is_ns(int num)
{
if(num%7==0) return 1;
else return 0;
}
int is_hs(int num)
{
while(num!=0)
{
if(num%10==7) break;
num=num/10;
}
if(num%10==7) return 1;
else return 0;
}
int main() {
int n,i,count=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(is_ns(i)||is_hs(i))
{
count++;
}
}
printf("%d",count);
return 0;
}