problem
solution
codes
#include<iostream>
using namespace std;
int num(int x){
int s[11] = {6,2,5,5,4,5,6,3,7,6};
if(x == 0)return s[0];
int ans = 0;
while(x != 0){
ans += s[x%10];
x /= 10;
}
return ans;
}
int main(){
int n, ans=0;
cin>>n;
for(int i = 0; i < 1000; i++)
for(int j = 0; j < 1000; j++)
if(num(i)+num(j)+num(i+j)+4 == n)
ans++;
cout<<ans;
return 0;
}
#include<iostream>
using namespace std;
int num[11] = {6,2,5,5,4,5,6,3,7,6};
int main(){
int n, ans = 0; cin>>n;
for(int i = 0; i < 1000; i++){
for(int j = 0; j < 1000; j++){
int a = i, b = j, c = i+j, t = 0;
if(a == 0)t += num[0];
if(b == 0)t += num[0];
if(c == 0)t += num[0];
while(a){
t += num[a%10];
a /= 10;
}
while(b){
t += num[b%10];
b /= 10;
}
while(c){
t += num[c%10];
c /= 10;
}
if(t == n-4) ans++;
}
}
cout<<ans<<"
";
return 0;
}