Cod sursa(job #1691587)
Utilizator | Data | 18 aprilie 2016 20:13:12 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include<fstream>
using namespace std;
ifstream fi("euclid2.in");
ofstream fo("euclid2.out");
int e(int a,int b){
if(!b) return a;
else return e(b,a%b);
}
long int a,b,t;
int main(){
fi>>t;
for(int i=1;i<=t;i++){
fi>>a>>b;
fo<<e(a,b)<<endl;;
}
fi.close();
fo.close();
return 0;
}