Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
125547 | 周震东 | 火柴棒等式 | C++ | 通过 | 100 | 370 MS | 728 KB | 657 | 2024-01-23 17:11:35 |
#include<bits/stdc++.h> using namespace std; long long n , res = 0; long long a[111111]; int f[]={6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6}; int abc(long long x){ long long sum = 0; if(x == 0){ return 6; } while(x > 0){ long long t = x % 10; sum += f[t]; x /= 10; } return sum; } int main(){ cin >> n; for(long long i = 0;i <= 30000; i++){ a[i] = abc(i); } for(long long i = 0;i <= 30000;i++){ for(long long j = i;j <= 30000; j++){ if(a[i] + a[j] + a[i + j] + 4 == n && i != j){ res += 2; } if(a[i] + a[j] + a[i + j] + 4 == n && i == j){ res++; } } } cout << res; return 0; }