8 条题解

  • 7
    @ 2017-10-12 09:02:10
    def gcd(a,b):
        if(b==0):
            return a
        else:
            return gcd(b,a%b)
    
    
    a=int(input())
    b=int(input())
    ans=gcd(a,b)
    ans1=a/ans*b
    print(ans,int(ans1))
    
  • 1
    @ 2019-04-21 12:27:37
    a=int(input())
    b=int(input())
    
    def rip(a,b):
     while a%b!=0:
      r=a%b
      a=b
      b=r
     if a%b==0:
      return(b)
    print(int(rip(a,b)),int(a*b/rip(a,b)))
    
  • 1
    @ 2018-10-23 18:28:50

    #include <cstdio>
    using namespace std;
    int gcd(int n1,int n2)
    {
    if(n1%n2==0) return n2;
    return gcd(n2,n1%n2);
    }
    int a,b;
    int main()
    {
    scanf("%d%d",&a,&b);
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
    }

  • 1
    @ 2017-10-23 15:37:36

    def gcd(a,b):
    if(b==0):
    return a
    else:
    return gcd(b,a%b)

    a=int(input())
    b=int(input())
    ans=gcd(a,b)
    ans1=a/ans*b
    print(ans,int(ans1))

  • 1
    @ 2017-10-20 12:39:19

    a=c=int(input())
    b=d=int(input())
    r=1
    while (a!=b):
    if r!=0:
    if a>b:

    r=a%b
    a=b
    b=r
    elif a<b:
    r=b%a
    b=a
    a=r
    (前一半代码

  • 1
    @ 2017-10-18 10:14:01

    import math
    a=int(input())
    b=int(input())
    c=1

    def HLsearch(a,b):
    if(a%b==0):
    return b
    return HLsearch(b,a%b)

    d=HLsearch(a,b)
    e=a*b/d
    print(d,'%.0f'%e)
    //还有交题解这样的操作...

  • 0
    @ 2018-10-23 18:28:40

    #include <cstdio>
    using namespace std;
    int gcd(int n1,int n2)
    {
    if(n1%n2==0) return n2;
    return gcd(n2,n1%n2);
    }
    int a,b;
    int main()
    {
    scanf("%d%d",&a,&b);
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
    }

  • 0
    @ 2017-10-23 15:37:45

    def gcd(a,b):
    if(b==0):
    return a
    else:
    return gcd(b,a%b)

    a=int(input())
    b=int(input())
    ans=gcd(a,b)
    ans1=a/ans*b
    print(ans,int(ans1))

  • 1

信息

难度
6
分类
(无)
标签
(无)
递交数
2043
已通过
552
通过率
27%
被复制
1
上传者