#include <iostream> #include <string> using namespace std; bool zhengchu(int n) {//能够整除7的 if (n % 7 == 0) return true; return false; } bool baohan(int n) {//包含数字7的 string str = to_string(n); for (int i = 0; i < str.size(); ++i) { if (str[i] == '7') return true; } return false; } int main() { int n; while (cin >> n) { int sum = 0; for (int i = 1; i <= n ; ++i) { if (!zhengchu(i) && !baohan(i)) { sum += i * i; } } cout << sum << endl; } }