Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
24577 | LeoWang | 火柴棒等式 | C++ | 通过 | 14 MS | 260 KB | 626 | 2023-08-14 04:56:23 |
#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; }