Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
104 | ZRH | 最大公约数(函数) | C++ | Accepted | 0 MS | 264 KB | 564 | 2022-07-20 01:23:32 |
#include<iostream> //输入函数库 #include<iomanip> #include<cmath> //数学函数库 #include<cstdio> #include<ctime> #include<cstring> #include<cstdlib> #include<string> #include<stdlib.h> #include<sys/time.h> using namespace std; int t(int x,int y){ int a=0; if(x>y){ for(int i=y;i>=0;i--){ if(x%i==0&&y%i==0){ return i; } } } else{ for(int i=x;i>=0;i--){ if(x%i==0&&y%i==0){ return i; } } } } int main(){ int x,y; cin>>x>>y; cout<<t(x,y); return 0; }