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 = 2
Output:
150
Explanation:
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 = 3
Output:
183
Explanation:
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 and Third bike, resulting in
a full tank for the second and third 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}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3

class Solution:
    def maxDist(self, N):
        # code here

Solutions:
class Solution:

	def maxDist(self, N):
		dist_covered = 0
		fuel = 100
		while N > 0:
			dist_covered = dist_covered + fuel / N
			N = N - 1
		return int(dist_covered)


class Solution:

	def maxDist(self, N):
		sum = 0
		for i in range(1, N + 1):
			z = 100 / i
			i += 1
			sum = sum + z
		return int(sum)


class Solution:

	def maxDist(self, N):
		bikes = N
		totalDist = 0
		for i in range(N):
			Distance = 100 / bikes
			totalDist = totalDist + Distance
			bikes = bikes - 1
		return int(totalDist)


class Solution:

	def maxDist(self, N):
		c = 0
		while N > 0:
			c += 100 / N
			N -= 1
		return int(c)


class Solution:

	def maxDist(self, N):
		h = 100
		f = 100
		for i in range(2, N + 1):
			h = h - h / i
			f = f + h
		return int(f)


class Solution:

	def maxDist(self, N):
		sum = 0
		for i in range(1, N + 1):
			z = 100 / i
			i += 1
			sum = sum + z
		return int(sum)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.maxDist(N))


class Solution:

	def maxDist(self, N):
		sum = 0
		for j in range(N, 0, -1):
			sum += 100 / j
		return int(sum)


class Solution:

	def maxDist(self, N):
		a = 0
		for i in range(N, 0, -1):
			a += 100 / i
		return int(a)