60分玄关求助
查看原帖
60分玄关求助
844625
Andy66楼主2024/7/18 16:12
#include<bits/stdc++.h>
using namespace std;
int a[10]={6,2,5,5,4,5,6,3,7,6};
int n,b,c,s;
int pcm(int f){
    int s1=0;
    while(f>0){
        s1+=a[f%10];
        f/=10;
    }
    return s1; 
}
bool bcm(int w,int x,int y,int e){
    int s2=0;
    s2+=pcm(w);
    s2+=pcm(x);
    s2+=pcm(y);
    if(s2==e)
        return true;
    return false;
}
int main(){
    cin>>n;
    n-=4;
    for(int i=0;i<1000;i++)
        for(int j=0;j<1000;j++) 
            if(bcm(i,j,i+j,n))
                    s++; 
    cout<<s; 
    return 0;
}
2024/7/18 16:12
加载中...