Cod sursa(job #2917109)
Utilizator | Data | 3 august 2022 12:55:21 | |
---|---|---|---|
Problema | Cel mai lung subsir comun | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <stdio.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int main() {
freopen("euclid2.in", "r", stdin);
freopen("euclid2.out", "w", stdout);
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", gcd(a, b));
}
return 0;
}