#include <iostream>
#include <cmath>
using namespace std;
bool is_Include_7(int x);
int main() {
int n;
cin>>n;
int res=0;
while (n>0) { // 注意 while 处理多个 case
if(n%7!=0 && !is_Include_7(n)){
res+=pow(n,2);
}
n--;
}
cout<<res<<endl;
}
bool is_Include_7(int x){
while (x>0) {
int temp = x%10;
if(temp==7)return true;
x/=10;
}
return false;
}
// 64 位输出请用 printf("%lld")
打卡:003;
引入库:#include<cmath> 使用函数pow(n,x) = n的x次幂
算法思路:枚举

京公网安备 11010502036488号