与7无关的数
与7无关的数
https://www.nowcoder.com/practice/776d401bf86d446fa783f0bef7d3c096?tpId=40&&tqId=21381&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking
#include<bits/stdc++.h>
using namespace std;
int Isabout(int x)
{
if((x%7==0)||(x%10==7)||(x/10)%10==7)
return 1;
else
return 0;
}
int main()
{
int n;
scanf("%d",&n);
int sum=0;
for(int i=1;i<=n;i++)
{
if(Isabout(i)==0)
{sum=sum+i*i;}
}
printf("%d\n",sum);
return 0;
}
using namespace std;
int Isabout(int x)
{
if((x%7==0)||(x%10==7)||(x/10)%10==7)
return 1;
else
return 0;
}
int main()
{
int n;
scanf("%d",&n);
int sum=0;
for(int i=1;i<=n;i++)
{
if(Isabout(i)==0)
{sum=sum+i*i;}
}
printf("%d\n",sum);
return 0;
}