Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141549 任艺宸 最大公约数(函数) C++ Accepted 0 MS 272 KB 484 2025-12-27 11:25:17

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 z(int a,int b) { int t; while(b!=0){ t=a%b; a=b; b=t; } return a; } int main(){ int m,n,x; cin>>m>>n; if(m>n){ x=m;m=n;n=x; } cout<<z(n,m); return 0; }