Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
124428 | 就这? | 火柴棒等式 | C++ | 通过 | 100 | 1 MS | 272 KB | 551 | 2024-01-23 14:31:03 |
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n; int res; int a[N]; int f[]={6,2,5,5,4,5,6,3,7,6}; int mz(int x){ int sum=0; if(x==0){ return 6; } while(x>0){ int t=x%10; sum+=f[t]; x/=10; } return sum; } int main(){ scanf("%d",&n); for(int i=0;i<=2000;i++){ a[i]=mz(i); } for(int i=0;i<=1000;i++){ for(int j=i;j<=1000;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++; } } } printf("%d\n",res); return 0; }