Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7405 黄宜洋 最大公约数(函数) C++ Accepted 0 MS 260 KB 497 2025-04-21 17:37:06

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int gcd(int m,int n){ int a=m,b=n,c=-1; while(b!=0){ c=b; b=a%b; a=c; } int ans=a; return ans; } int main(){ int m,n; cin>>m>>n; printf("%d",gcd(m,n)); return 0; }