Pagini recente » Cod sursa (job #2050819) | Cod sursa (job #374760) | Cod sursa (job #689530) | Cod sursa (job #2784560) | Cod sursa (job #2974467)
/// [A][M][C][B][N] ///
#include <bits/stdc++.h>
const int mod = 20173333;
const int inf = 0x3f3f3f3f;
const char sp = ' ', nl = '\n';
using namespace std;
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
long long gcd(long long a, long long b, long long& x, long long& y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
long long x1, y1;
long long d = gcd(b, a % b, x1, y1);
x = y1;
y = x1 - y1 * (a / b);
return d;
}
int main() {
int t;
fin >> t;
while (t--) {
long long a, b, x, y, c;
fin >> a >> b >> c;
long long g = gcd(a, b, x, y);
if (c % g) {
fout << 0 << sp << 0 << nl;
}
else {
fout << x * (c / g) << sp << y * (c / g) << nl;
}
}
}