Pagini recente » Cod sursa (job #1866534) | Cod sursa (job #2534836) | Cod sursa (job #1909255) | Cod sursa (job #2730968) | Cod sursa (job #2682049)
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
int euclid(int a, int b, int &x, int &y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
int x0, y0;
int d = euclid(b, a % b, x0, y0);
x = y0;
y = x0 - (a / b) * y0;
return d;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
fin >> t;
while (t--) {
int a, b, c;
fin >> a >> b >> c;
int x, y;
int d = euclid(a, b, x, y);
if (c % d) {
fout << "0 0\n";
} else {
fout << x * (c / d) << " " << y * (c / d) << "\n";
}
}
return 0;
}