最后一组题目给的输入24,输出128,我得98。
#include <bits/stdc++.h>
using namespace std;
int match[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
int main() {
int n;
cin >> n;
n -= 4;
if (n < 0) {
cout << 0 << endl;
return 0;
}
int ans = 0;
for (int A = 0; A <= 100; ++A) {
for (int B = 0; B <= 100; ++B) {
int C = A + B;
if (C > 100) break;
int t = match[A % 10] + match[B % 10] + match[C % 10];
if (A >= 10) t += match[A / 10];
if (B >= 10) t += match[B / 10];
if (C >= 10) t += match[C / 10];
if (A >= 100) t += match[A / 100];
if (B >= 100) t += match[B / 100];
if (C >= 100) t += match[C / 100];
if (t == n) {
ans++;
}
}
}
cout << ans << endl;
return 0;
}