Pagini recente » Cod sursa (job #762221) | Cod sursa (job #3142564) | Cod sursa (job #2064613) | Cod sursa (job #1315871) | Cod sursa (job #1342277)
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#define INF (1<<30)
#define mod 666013
using namespace std;
typedef long long LL;
LL t, a, b, c, d, x, y;
int E(LL a, LL b)
{
if(b==0)
{
x=1;
y=0;
return a;
}
LL d=E(b, a%b);
LL yy=y;
y=x-y*(a/b);
x=yy;
return d;
}
int main()
{
freopen("euclid3.in", "r", stdin);
freopen("euclid3.out", "w", stdout);
scanf("%lld", &t);
while(t--)
{
scanf("%lld%lld%lld", &a, &b, &c);
x=y=0;
d=E(a, b);
if(c%d)
printf("0 0\n");
else
printf("%lld %lld\n", x*c/d, y*c/d);
}
return 0;
}