提交时间:2022-08-01 11:37:19
运行 ID: 54358
#include<bits/stdc++.h> using namespace std; long long n,m; long long work(long long x,long long y) { if(x==y) { return x; } else { return work(min(y-x,x),max(y-x,x))+x; } } int main() { scanf("%lld%lld",&n,&m); printf("%lld\n",work(min(n,m),max(n,m))); return 0; }