#include <limits> unsigned long gcd(unsigned long a, unsigned long b) { unsigned long fr, sr; fr = max(a,b); sr = min(a,b); unsigned long r = 1; while(r > 0){ r = fr%sr; fr = sr; sr = r; } return fr; }
最大公约数
最新推荐文章于 2024-05-20 20:16:31 发布
#include <limits> unsigned long gcd(unsigned long a, unsigned long b) { unsigned long fr, sr; fr = max(a,b); sr = min(a,b); unsigned long r = 1; while(r > 0){ r = fr%sr; fr = sr; sr = r; } return fr; }