6

P1618 三连击(升级版)

chenyifan12 @ 2024-09-23 20:01:42

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double g,s,b,g1,s1,b1,g2,s2,b2;
    double a3,b3,c3,a4,b4,c4;
    bool e=false;
    cin>>a3>>b3>>c3;
    a4=999/(a3+b3+c3)*a3;
    b4=999/(a3+b3+c3)*b3;
    c4=999/(a3+b3+c3)*c3;
    for(int i=100;i<=a4;i++){
        for(int j=100;j<=b4;j++){
            for(int f=100;f<=c4;f++){
                g=i%10;
                s=i/10%10;
                b=i/100%10;
                g1=j%10;
                s1=j/10%10;
                b1=j/100%10;
                g2=f%10;
                s2=f/10%10;
                b2=f/100%10;
                if(i*(b3/a3)==j&&i*(c3/a3)==f&&j*(c3/b3)==f&&g+s+b+g1+s1+b1+g2+s2+b2==45&&g*s*b*g1*s1*b1*g2*s2*b2==725760){
                    cout<<i<<" "<<j<<" "<<f<<endl;
                    e=true;
                }
            }
        }
    }
    if(e){
       return 0; 
    }
    else
    {
     cout<<"No!!!"; 
    }
}

|