题解 | 与7无关的数
与7无关的数
https://www.nowcoder.com/practice/776d401bf86d446fa783f0bef7d3c096
#include <iostream>
using namespace std;
int main() {
int n;
while (scanf("%d",&n)!=EOF) { // 注意 while 处理多个 case
int sum=0;
for(int i=1; i<=n;i++){
if(i%7==0 || i/10==7 || i%10==7){
continue;
}else {
sum+=i*i;
}
}
printf("%d\n",sum);
}
}
// 64 位输出请用 printf("%lld")
查看22道真题和解析