提交时间:2024-11-06 23:05:59

运行 ID: 55419

#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; int n,ans = 0; int s[10] = {6,2,5,5,4,5,6,3,7,6}; int shuliang(int x) { if (x == 0) return 6; int sum = 0; while (x > 0) { sum += s[x % 10]; x /= 10; } return sum; } int main() { scanf("%d",&n); for (int i = 0; i < 1000; i++) for (int j = 0; j < 1000; j++) { int a = shuliang(i) + shuliang(j); int b = shuliang(i + j); if (a + b + 4 == n) ans++; } printf("%d",ans); return 0; }