提交时间:2023-08-24 10:34:13

运行 ID: 99929

#include<bits/stdc++.h> #define int long long using namespace std; namespace Fast{ inline int fr(){ int x = 0,f = 1; char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x < 0){ x = -x; putchar('-'); } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } } using namespace Fast; int hcg[15] = {6,2,5,5,4,5,6,3,7,6},b[4005],ans; signed main(){ int n = fr(); n -= 4; b[0] = 6; for (int i = 1;i <= 2000;i++){ int x = i; while (x){ b[i] += hcg[x % 10]; x /= 10; } } for (int i = 0;i <= 1000;i++){ for (int j = 0;j <= 1000;j++){ if (b[i] + b[j] + b[i + j] == n){ ans++; } } } fw(ans); return 0; }