5 solutions

  • 0
    @ 2025-7-5 10:29:32
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,m,a;
        bool b=true;
    	cin>>n>>m;
        if(n<m) 
        {
            a=n;
            n=m;
            m=a;
        }
        for(long long i=n;i<=100000000;i++)
        {
            if(b && i%n==0 && i%m==0)
            {
                cout<<i<<' ';
                b=false;
            }
        }
        b=true;
        for(int i=m;i>=0;i--)
        {
            if(b && n%i==0 && m%i==0) 
            {
                cout<<i;
                b=false;
            }
        } 
    	return 0;
    }
    

    Information

    ID
    2155
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    1
    Tags
    # Submissions
    76
    Accepted
    34
    Uploaded By