何小波


私信TA

用户名:20211105138

访问量:1818

签 名:

等  级
排  名 10347
经  验 1041
参赛次数 1
文章发表 5
年  龄 0
在职情况 学生
学  校 大连民族大学
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

   

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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

不擦
2021-12-04 21:34:51
  • «
  • 1
  • »