题解 | 与7无关的数 (最短写法)
与7无关的数
https://www.nowcoder.com/practice/776d401bf86d446fa783f0bef7d3c096
#include <bits/stdc++.h> using namespace std; signed main() { int n; while (cin >> n) { long long res = 0; for (int i = 1; i <= n; i++) if (!(i % 7 == 0 || to_string(i).find('7') != string::npos)) res += i * i; cout << res << '\n'; } return 0; }