31 lines
611 B
C
31 lines
611 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int a,b,c,d,e,f,temp,x,y;
|
|
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
|
|
|
|
for(x=-999; x<1000; x++) {
|
|
if(b==0) {
|
|
if(a*x != c || e==0) continue;
|
|
temp = f - d*x;
|
|
if(temp%e==0) {
|
|
y = temp / e;
|
|
}
|
|
else continue;
|
|
}
|
|
else {
|
|
temp = c - a*x;
|
|
if(temp%b==0) {
|
|
y = temp / b;
|
|
}
|
|
else continue;
|
|
}
|
|
|
|
if(d*x+e*y==f){
|
|
printf("%d %d\n", x,y);
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |