Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int t,a,b;
  4. int miojo(int amp1, int amp2){
  5. if(amp1==t || amp2==t){
  6. return t;
  7. }
  8. else
  9. if(amp1>amp2){
  10. return amp2+miojo(amp1-amp2,amp2);
  11. }
  12. else{
  13. return amp1+miojo(amp1,amp2-amp1);
  14. }
  15. }
  16. int main(){
  17. cin>>t>>a>>b;
  18. int tempo = miojo(a,b);
  19. cout<<tempo<<endl;
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement