举例:输入:N = 100,X = 60输出: 3解释:在t1时,总投资为100,总利为60.在t2时,总投资为200,总利为180 (60 + 120).在t3时,总投资为300,总利为360,所以总利高于总投资,因此答案为3.
您得到了两个整数,N和X.N表示投资的价格,X表示投资所带来的利.您可以投资多次,每次从其基本价值增加利.每一轮都是投资.您的任务是计算达到充分利的投资数量,这意味着之前的所有投资的价格已经超过.如果无法达到利,您应该返回糟糕的投资.
To solve the problem, you can use a loop to simulate the investments and track the total investment and profit. In each iteration of the loop, you add the initial price to the total investment and add the profit to the total profit. If the total profit is greater than or equal to the total investment, you have reached rentability and can return the number of iterations. If the loop finishes without reaching rentability, you should return "Bad Investment". 

Here is some sample code in Python:

```
def calculate_investments(N, X):
    total_investment = 0
    total_profit = 0
    count = 0
    while total_profit < N:
        count += 1
        total_investment += N
        total_profit += X
        if total_profit >= total_investment:
            return count
    return "Bad Investment"

# Example usage
print(calculate_investments(100, 60))  # Output: 3
```