解题思路:
注意事项:
参考代码:
def yue(a,b):
min =(a<b and a or b)
i=min
while i>0:
if a%i==0 and b%i==0:
return i
i-=1
return 1
def bei(a,b):
max=(a>b and a or b)
i=max
while i<a*b:
if i%a==0 and i%b==0:
return i
i+=1
return a*b
def main():
a, b = map(int, input().strip().split())
print(yue(a,b),end=" ")
print(bei(a,b))
main()
0.0分
1 人评分
奖学金 (C++代码)浏览:2008 |
C语言训练-字符串正反连接 (C语言代码)浏览:622 |
C语言程序设计教程(第三版)课后习题9.4 (Java代码)浏览:1419 |
简单的a+b (C++语言代码)浏览:860 |
简单的a+b (C语言代码)浏览:531 |
水仙花 (C语言代码)浏览:1054 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:600 |
计算质因子 (C语言代码)浏览:707 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:673 |
敲七 (C语言代码)浏览:2701 |