1 solutions

  • 0
    @ 2025-12-2 15:43:09

    C++ :

    #include<iostream>
    
    #include<fstream>
    
    #include<algorithm>
    
    using namespace std;
    
    long long a,b,s,sum;
    
    int main()
    
    {
    
    
       cin>>a>>b;                        
    
       while (a!=b && a!=0 && b!=0)     
    
       {
    
         s=a/b;                         
    
         sum+=s;                       
    
         a=a-b*s;                  
    
         swap(a,b);                  
    
       }
    
       cout<<sum;                        
    
       return 0;
    
    }
    
    • 1

    Information

    ID
    663
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By