Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
11194 hukaiyuan 火柴棒等式 C++ 编译错误 0 MS 0 KB 780 2023-03-05 15:03:12

Tests(0/0):


1 #include <iostream> 2 #include <iomanip> 3 #include <cstdio> 4 #include <cmath> 5 #include <cstring> 6 #include <algorithm> 7 #include <ctime> 8 using namespace std; 9 int sum[11] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}; 10 int n,t = 0; 11 int work(int x) { 12 int ans = 0, k; 13 if(x == 0) return sum[0]; 14 else { 15 while(x != 0) { 16 k = x % 10; 17 x /= 10; 18 ans += sum[k]; 19 } 20 return ans; 21 } 22 } 23 int main() { 24 cin >> n; 25 for(int i = 0; i <= 1000; i++) 26 for(int j = 0; j <= 1000; j++) { 27 if(work(i) + work(j) + work(i + j) + 4 == n) 28 t++; 29 } 30 cout << t << '\n'; 31 return 0; 32 }


测评信息: