Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
125529 | 余冠学 | 火柴棒等式 | C++ | 解答错误 | 40 | 0 MS | 252 KB | 629 | 2024-01-23 17:08:06 |
# include <iostream> # include <memory.h> using namespace std; const int num[11] = {6,2,5,5,4,5,6,3,7,6}; bool record[24]; int getn(int x){ if (x == 0) return 6; int sum = 0; while (x != 0){ sum += num[(x % 10)]; x /= 10; }return sum; }int main(){ memset(record,true,sizeof(record)); int n,cnt = 0; cin >> n; if (n < 8){ cout << 0; return 0; }n -= 4; for (int a = 0;a <= n;a++){ for (int b = 0;b <= n;b++){ int c = a + b; if (getn(a) + getn(b) + getn(c) == n && (a != b || record[a])){ cnt++; if (a == b) record[a] = !record[a]; } } }cout << cnt; return 0; }