提交时间:2024-01-23 08:21:45
运行 ID: 123496
#include <bits/stdc++.h> using namespace std; int n, ans; int tab[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}; int get_sum(int x) { if (x == 0) return tab[x]; int res = 0; while (x) { res += tab[x%10]; x /= 10; } return res; } signed main() { scanf("%d", &n); n -= 4; for (int i=0; i<1000; i++) { for (int j=0; j<1000; j++) { if (get_sum(i)+get_sum(j)+get_sum(i+j) == n) { ans++; } } } printf("%d", ans); return 0; }