Cod sursa(job #1872223)
| Utilizator | Data | 7 februarie 2017 23:53:16 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid extins | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <iostream>
#include <cmath>
using namespace std;
int main() {
ifstream in("euclid3.in");
ofstream out("euclid3.out");
unsigned t;
in >> t;
for(unsigned i = 0; i < t; ++i) {
int a,b,c;
in >> a >> b >> c;
EuclidResult res = euclid(a,b);
if((c*1.0f)/res.gcd != c/res.gcd) {
out << "0 0\n";
}
else {
int rap = c/res.gcd;
out << res.x*rap << ' ' << res.y*rap << '\n';
}
}
return 0;
}