1 solutions

  • 0
    @ 2025-12-3 16:15:31

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int a,b;
    int main()
    {
        //freopen("1045.in","r",stdin);
    	//freopen("1045.out","w",stdout);
        cin>>a>>b;
        if(a>b){swap(a,b);}
        for(int i=a; ;i--)
    	{
    		if(a%i==0&&b%i==0)
    		{
    			cout<<i;
    			break;
    		}
    		
    	} 
    
        return 0;
    }
    
    • 1

    Information

    ID
    849
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    5
    Accepted
    4
    Uploaded By