Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
123496 | 廖悦扬 | 火柴棒等式 | C++ | 通过 | 100 | 21 MS | 252 KB | 479 | 2024-01-23 08:21:45 |
#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; }