Cod sursa(job #2251707)
Utilizator | Data | 1 octombrie 2018 21:12:57 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int a,b,t,T;
f>>T;
while (T)
{
f>>a>>b;
while (a!=b)
{
if (a>b)
a=a-b;
else b=b-a;
}
g<<a<<"\n";
T--;
}
}