Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- float n,a,b;
- float T1,T2;
- float Tot1;
- float Tot2;
- float pos;
- int i;
- cin>>n>>a>>b;
- if(a==b){
- cout<<n<<endl;
- }else if(a<b){
- T1=a;
- T2=b;
- }else{
- T1=b;
- T2=a;
- Tot1=0;
- i=0;
- }if(i<n){
- do{
- Tot1=Tot1+T1;
- T1=2*T1;
- i=i+1;
- }while(i<n);
- }else{
- Tot2=0;
- pos = 0;
- }if(Tot2<Tot1) {
- do {
- Tot2 = Tot2 + T2;
- T2 = 2 * T2;
- pos = pos + 1;
- } while (Tot2 < Tot1);
- }else{
- cout<<pos<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement