import java.util.*; public class LANQIAO1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int x ,y; for (int i = 0; i < t; i++) { x = sc.nextInt(); y = sc.nextInt(); System.out.println(f(x , y)); } } private static int f(int x, int y) { if(y == 0) return x; else return f(y, x % y); } }
蓝桥杯真题-最大公约数快速算法
最新推荐文章于 2024-07-15 22:10:26 发布