提交时间:2023-09-01 13:12:54

运行 ID: 100744

#include <bits/stdc++.h> using namespace std; int main(){ int num[10] = {6,2,5,5,4,5,6,3,7,6}; int n; cin>>n; n-=4; int ans = 0; for(int i = 1;i<=1000;i++){ for(int j = 1;j<=1000;j++){ int tmp1 = i; int tmp2 = j; int tmp3 = i+j; int cnt = 0; if(tmp1==0) cnt+=6; while(tmp1>0){ cnt+=num[tmp1%10]; tmp1 = tmp1/10; } if(tmp2==0) cnt+=6; while(tmp2>0){ cnt+=num[tmp2%10]; tmp2/=10; } if(tmp3==0) cnt+=6; while(tmp3>0){ cnt+=num[tmp3%10]; tmp3 = tmp3/10; } if(cnt==n) ans++; } } cout<<ans<<endl; return 0; }