Pagini recente » Cod sursa (job #959219) | Cod sursa (job #2503351) | Cod sursa (job #20674) | Cod sursa (job #1626362) | Cod sursa (job #2919592)
#include <bits/stdc++.h>
using namespace std;
void solve(int a, int b, int c, int &x, int &y) {
if(b == 0) {
if(c % a)
return;
x = c / a;
y = 23;
return;
}
solve(b, a % b, c, x, y);
int cat = a / b;
int x1 = x, y1 = y;
x = y1;
y = x1 - y1 * cat;
}
int main()
{
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
int t;
fin >> t;
for(int test = 0; test < t; test++) {
int a, b, c;
fin >> a >> b >> c;
int x, y;
x = y = 0;
solve(a, b, c, x, y);
fout << x << " " << y << '\n';
}
return 0;
}