Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6380 |

@mb1973 | 5642 |

@Quandray | 5233 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4610 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3413 |

Complete Leaderboard | |

Handle | Score |

@sanskar94511 | 603 |

@akashverma4 | 363 |

@swastik8750 | 300 |

@nishunishuraj18 | 286 |

@surajmamgai | 264 |

@anks9013 | 222 |

@nayan2709 | 213 |

@burhanuddinbohra72 | 212 |

@realname | 203 |

@amank8975 | 203 |

@manmeetkaur18102000 | 202 |

Complete Leaderboard |

There are **N **bikes and each can cover 100 km when fully fueled. What is the maximum amount of distance you can go using N bikes? You may assume that all bikes are similar and a bike takes 1 litre to cover 1 km.

**Note: **The answer may contain decimal value but print the integer value of the float value obtained.

**Example 1:**

Input:N =2Output:150Explanation:The 2 bikes can travel 50 Kms together and then, the fuel of the First bike can be transferred to the Second, resulting in a full tank for the second bike. The 2nd bike will be able to travel 100 Kms more. So, the Ouput is 150.

**Example 2:**

Input:N =3Output:183Explanation:The 3 bikes can travel 33.33 Kms together and then, rest of the fuel of the First bike can be transferred to the Second, resulting in a full tank for the second bike. The 2nd and 3rd bike can travel 50 Kms more together. Now, both the bikes will have half fuel. The 2nd bike can transfer the fuel to the 3rd. The 3rd will have a full tank and travel 100 Kms more. So, the Distance will be 183.33

**Your Task:**

You don't need to read input or print anything. Your task is to complete the function **maxDist()** which takes an Integer N as input and returns the answer.

**Expected Time Complexity:** O(N)

**Expected Auxiliary Space:** O(1)

**Constraints:**

1 <= N <= 10^{5}

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Maximum distance

...