Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
55419 zhangweiran 火柴棒等式 C++ 通过 15 MS 252 KB 626 2024-11-06 23:05:59

Tests(1/1):


#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; }


测评信息: