0
已解决
曹博扬
初级天翼
初级天翼
#include <iostream>
#include <algorithm>
using namespace std;
int x,y,z;
long long a1,b1,c1;
long long a2,b2,c2;
long long a3,b3,c3;
int x1,y1,z1,s=0x3f3f3f3f,c;
int main(){
cin>>x>>y>>z;
cin>>a1>>b1>>c1;
cin>>a2>>b2>>c2;
cin>>a3>>b3>>c3;
if(x==0||y==0||z==0){
cout<<"NONE";
return 0;
}
for(int i=0;i<=100;i++){
for(int j=0;j<=100;j++){
for(int k=0;k<=100;k++){
int q=i*a1+j*a2+k*a3;
int w=i*b1+j*b2+k*b3;
int e=i*c1+j*c2+k*c3;
if(q%x==0&&w%y==0&&e%z==0){
q/=x;
w/=y;
e/=z;
if(q==w&&w==e&&(i!=0||j!=0||k!=0)){
if(q<s){
c++;
s=q;
x1=i;
y1=j;
z1=k;
}
}
}
}
}
}
if(c>0)
cout<<x1<<" "<<y1<<" "<<z1<<" "<<s;
else
cout<<"NONE";
return 0;
}
83分