题解 | #与7无关的数#
与7无关的数
https://www.nowcoder.com/practice/776d401bf86d446fa783f0bef7d3c096
#include<cstdio> int Judge7(int n){ int a,b,c; int x=n; c=n%10; n=n/10; b=n%10; n=n/10; a=n%10; if(0==x%7 || 7==a || 7==b || 7==c ){ return 0; } else return x; } int main(){ int i,sum=0; scanf("%d",&i); for(int j=0;j<=i;++j){ sum= sum+Judge7(j)* Judge7(j); } printf("%d\n",sum); }