竞赛
考级
法兰西玫瑰
逍遥骇好=&
亚洲卷王 AK IOI
烙铁
官方:=D(开心死了)
卢某人
#include<iostream> using namespace std; int GCD(int a,int b) { int c ; do { c=a%b ; a=b ; b=c ; }while(c!=0); return a ; } int LCM(int d,int e) { int z,f ; z=GCD(d,e) ; f=d*e/z ; return f ; } int main(){ int a,b; cin>>a>>b; cout<<"GCD="<<GCD(a,b)<<endl; cout<<"LCM="<<LCM(a,b)<<endl; }
小king
回来看看
题解: 注:FOR循环是可有空缺的,例如:
AC
礼堂钉针
我和“进步的蜗牛”的小伙伴都在ACGO等你,快用这个专属链接加入我们吧! 点我加入
i amthebest™搬至洛谷
毛奕程
༺ཌༀ元气满满ༀད༻
HXB
邱澤銳·龍龘龖🔥#已疯#
有事找大号
暴力出奇迹,结果TLE
Tian
#include <iostream> using namespace std; int a,b; int f(int x,int y){ if(x%y == 0) return y; return f(y,x%y); } int main(){ cin >> a>>b; cout <<"GCD="<< f(a,b) <<endl; cout <<"LCM="<< a*b/f(a,b); return 0; }
谁教我C++(我勒个雷)
???
黑客_天之神_ZDZL_zsy