Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. //#include "stdafx.h"
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int a, b, ans(0);
  9.     cin >> a >> b;
  10.     while (b > 0 && a > 0) {
  11.         ans += a / b;
  12.         a %= b;
  13.         swap(a, b);
  14.     }
  15.     cout << ans << endl;
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement