Advertisement
Guest User

Untitled

a guest
Oct 28th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main(){
  6.  
  7. float n,a,b;
  8. float T1,T2;
  9. float Tot1;
  10. float Tot2;
  11. float pos;
  12. int i;
  13. cin>>n>>a>>b;
  14.  
  15. if(a==b){
  16. cout<<n<<endl;
  17. }else if(a<b){
  18. T1=a;
  19. T2=b;
  20. }else{
  21. T1=b;
  22. T2=a;
  23. Tot1=0;
  24. i=0;
  25. }if(i<n){
  26. do{
  27. Tot1=Tot1+T1;
  28. T1=2*T1;
  29. i=i+1;
  30. }while(i<n);
  31. }else{
  32. Tot2=0;
  33. pos = 0;
  34.  
  35. }if(Tot2<Tot1) {
  36. do {
  37. Tot2 = Tot2 + T2;
  38. T2 = 2 * T2;
  39. pos = pos + 1;
  40.  
  41. } while (Tot2 < Tot1);
  42. }else{
  43. cout<<pos<<endl;
  44. }
  45.  
  46.  
  47.  
  48. return 0;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement