PGCD récursif
Étant donnés deux entiers a
et b
, écrivez une fonction récursive pour calculer le plus grand diviseur commun (PGCD) de a
et b
.
Entrée
L’entrée contient deux entiers séparés par un espace a
et b
(1 ≤ a, b ≤ ).
Sortie
Le programme doit afficher le PGCD de a
et b
.
Exemples
Entrée | Sortie |
---|---|
8 12 | 4 |
5 25 | 5 |
7 13 | 1 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB