Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
731 邓小龙 最大公约数(函数) C++ Accepted 0 MS 268 KB 459 2023-03-04 16:01:38

Tests(10/10):


Code:

/* 思路: 1.求最大公约数->函数 2.从起始年到结束年,每一年都去判断,是就+1 */ # include<iostream> #include<cmath> using namespace std; int gcb(int x,int y){ int t; while(x!=0) { if (y==0) return x; else { t=x%y; x=y; y=t; } } } int main(){ int a,b; cin>>a>>b; cout<<gcb(a,b); return 0; }