Pagini recente » Cod sursa (job #826496) | Cod sursa (job #1957293) | Cod sursa (job #1505711) | Cod sursa (job #2821989) | Cod sursa (job #1289873)
#include<cstdio>
#include<fstream>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<bitset>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<unordered_map>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;
int t, a, b, c, d, x, y;
int gcd(int a, int b, int &x, int &y)
{
if(b == 0)
{
x = 1;
y = 0;
return a;
}
int d, x0, y0;
d = gcd(b, a % b, x0, y0);
x = y0;
y = x0 - (a / b) * y0;
return d;
}
int main()
{
freopen("euclid3.in", "r", stdin);
freopen("euclid3.out", "w", stdout);
scanf("%d", &t);
for(; t; t--)
{
scanf("%d%d%d", &a, &b, &c);
d = gcd(a, b, x, y);
if(c % d) printf("0 0\n");
else printf("%d %d\n", x * (c / d), y * (c / d));
}
return 0;
}