Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
96698 刘轻松 15求两个数的最大公约数 C++ Accepted 1 MS 272 KB 298 2024-11-09 11:57:27

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ long long a,b,yushu,t; cin>>a>>b; if(a<b){ t =a; a = b; b = t; } //辗转相处法-求最大公约数 yushu = a%b; while(yushu != 0){ a = b; b = yushu; yushu = a%b; } cout<<b; return 0; }