#include <stdio.h> int main() { int a, b, t; while (scanf("%d %d", &a, &b) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to if (a>b){ t = a; a = b; b = t; } while(a%b!=0){ t = a%b; a = b; b = t; } printf("%d",b); } return 0; }
#include <stdio.h> int main() { int a, b, t; while (scanf("%d %d", &a, &b) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to if (a>b){ t = a; a = b; b = t; } while(a%b!=0){ t = a%b; a = b; b = t; } printf("%d",b); } return 0; }