蒟蒻80分,求助

P1618 三连击(升级版)

CHkuakeU @ 2024-03-12 22:01:00

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,z,f=1;
    cin>>x>>y>>z;
    for(int a=1;a<1000;a++)
    {
        int a1=a*x;
        int b=a*y;
        int c=a*z;
        if((a1/100)+(a1/10%10)+(a1%10)+(b/100)+(b/10%10)+(b%10)+(c/100)+(c/10%10)+(c%10)==45&&(a1/100)*(a1/10%10)*(a1%10)*(b/100)*(b/10%10)*(b%10)*(c/100)*(c/10%10)*(c%10)==362880)
        {
            cout<<a<<" "<<b<<" "<<c<<" "<<endl; 
            f=0;
        } 
    }
    if(f==1)    cout<<"No!!!";
}

|