提交时间:2023-06-12 19:45:05
运行 ID: 20257
#include <bits/stdc++.h> using namespace std; bool has3or7(unsigned int x) { while (x>0) { if (x % 10 == 7 or x % 10 == 3) { return 1; } else { x = x/10; } } return 0; } int main() { unsigned int N; cin >> N; long long res = 0; unsigned int divi1=N/3; unsigned int i, j, k; for (i = 1; i <= divi1; i++) { for (j = i + 1; j <= (N - i) / 2; j++) { if (i == j) { continue; } else { k = N - i - j; if (k == j) { continue; } else { if (has3or7(i) or has3or7(j) or has3or7(k)) { continue; } else { res++; } } } } } cout << res << endl; }