提交时间:2023-08-24 10:28:23
运行 ID: 99923
#include<bits/stdc++.h> using namespace std; bool vis[50][50]; int main(){ int n; cin>>n; n -= 4; int cnt = 0; int a[10]; a[0] = 6;a[1] = 2;a[2] = 5;a[3] = 5;a[4] = 4;a[5] = 5;a[6] = 6;a[7] = 3;a[8] = 7;a[9] = 6; for(int i = 0;i<=n;i++){ for(int j = 0;j<=n;j++){ int k = i+j; int tmp1 = i; int tmp2 = j; if(vis[i][j]) continue; vis[i][j] = true; int sum = 0; if(k==0) sum+=a[0]; else{ while(k>0){ sum+=a[k%10]; k/=10; } } if(tmp1==0) sum+=a[0]; else{ while(tmp1>0){ sum+=a[tmp1%10]; tmp1 = tmp1/10; } } if(tmp2==0) sum+=a[0]; else{ while(tmp2>0){ sum+=a[tmp2%10]; tmp2/=10; } } if(sum==n){ cnt++; } } } cout<<cnt<<endl; return 0; }