Advertisement
Eather

GCD Euclid

Jun 5th, 2011
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1.                        /*Bismillahir Rahmanur Rahim*/
  2. //Template created by topcoder00
  3.  
  4. # include <list>
  5. # include <deque>
  6. # include <bitset>
  7. # include <algorithm>
  8. # include <functional>
  9. # include <numeric>
  10. # include <utility>
  11. # include <sstream>
  12. # include <iostream>
  13. # include <iomanip>
  14. # include <cstdio>
  15. # include <cmath>
  16. # include <cstdlib>
  17. # include <ctime>
  18. # include <set>
  19. # include <map>
  20. # include <cmath>
  21. # include <queue>
  22. # include <limits>
  23. # include <stack>
  24. # include <vector>
  25. # include <cstring>
  26. # include <cstdio>
  27. # include <fstream>
  28. using namespace std;
  29.  
  30. int pel(string s){string t;t=s;reverse(t.begin(),t.end());if(s==t)return 1;return 0;}
  31. string toString(int n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
  32. int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
  33. bool isprime(int m){if(m<2) return 0;for( int i=2; i*i<=m ; i++)if(m%i==0)return 0; return 1;return 0;}
  34.  
  35. # define __(array,w)   memset(array,w,sizeof array)
  36. # define FOR(i, a, b) for (int i=a; i<b; i++)
  37. # define REP(i, a) FOR(i,0,a)
  38. # define all(c) (c).begin(), (c).end()
  39. # define sz(x) x.size()
  40. # define MAX INT_MAX
  41. # define pb push_back
  42. # define MP make_pair
  43. # define X first
  44. # define Y second
  45. # define SBS(s,a,b) (s).substr(a,b)
  46. # define UNQ(s) {sort(all(s));(s).erase(unique(all(s)),s.end());}
  47. # define rive(s) reverse(s.begin(),s.end())
  48. # define VI vector<int>
  49. # define VS vector<string>
  50. # define VC vector<char>
  51. # define out(a) cout<<#a<<"= "<<a<<endl;
  52. int cou;
  53.  
  54. int gcd(int Input1, int Input2)
  55. {
  56.     cou++;
  57.     if(Input2==0)return Input1;
  58.     return gcd(Input2,Input1%Input2);
  59. }
  60.  
  61. int main()
  62. {
  63.  
  64.     int test,tcase=0;
  65.     int input1,input2;
  66.     cou=0;
  67.     cin>>input1>>input2;
  68.     gcd(input1,input2);
  69.     out(cou);
  70.  
  71.     return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement