Money Saving in Bank Problem

Harshit wants to save up money for his first car by depositing money daily in the Ninja bank with a specific increment strategy.

Starting with 1 rupee on the first Monday, the amount increases by 1 rupee each day from Tuesday to Sunday. Each new Monday starts with an additional rupee more than the previous Monday's deposit.

Your task is to calculate the total money Harshit will have at the end of the Nth day given a positive integer N.

Input:

The first line contains a single integer T, the number of test cases.
For each test case, a single integer N is provided denoting the number of days.

Output:

For each test case, output the total amount of money accumulated after N days.
Print each result on a new line.

Example:

Input:
2
2
5

Output:
3
15

Constraints:

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 5000
  • Time limit: 1 second

Note:

For the given test cases:
With N = 2, Harshit deposits 1 on Day 1 and 2 on Day 2, totaling 3 rupees.
With N = 5, his total deposits are 1 on Day 1, 2 on Day 2, 3 on Day 3, 4 on Day 4, and 5 on Day 5, totaling 15 rupees.

AnswerBot
2d

Calculate the total money accumulated by Harshit in Ninja bank after N days with a specific increment strategy.

  • Start with 1 rupee on the first Monday and increase by 1 rupee each day from Tuesday to S...read more

Help your peers!
Add answer anonymously...
DE Shaw Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter