直接枚举到100水过
/*
ID: shangca2
LANG: C++
TASK: ratios
*/
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
using namespace std;
#define INF 0xfffffff
int a[][];
int main()
{
freopen("ratios.in","r",stdin);
freopen("ratios.out","w",stdout);
int i,j,x,y,z,g,o1,o2,o3,o4;
cin>>x>>y>>z;
for(i = ; i <= ; i++)
for(j = ; j <= ; j++)
cin>>a[i][j];
int minz = INF;
for(i = ; i <= ; i++)
for(j = ; j <= ; j++)
for(g = ; g <= ; g++)
{
int xx = i*a[][]+j*a[][]+g*a[][];
int yy = i*a[][]+j*a[][]+g*a[][];
int zz = i*a[][]+j*a[][]+g*a[][];
if(xx+yy+zz<(x+y+z))
continue;
if(double(xx)/double(yy)==double(x)/double(y)&&double(yy)/double(zz)==double(y)/double(z))
{
if(minz>(i+j+g))
{
o1 = i;
o2 = j;
o3 = g;
o4 = xx/x;
minz = i+j+g;
}
}
}
if(minz!=INF)
cout<<o1<<" "<<o2<<" "<<o3<<" "<<o4<<endl;
else
puts("NONE");
return ;
}