Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Code at the Time of Pandemic

By Hasinur_ · Limits 1s, 512 MB

The whole world is going through a hard time. Every day thousands of people are dying and many are getting infected by the SARS-CoV-2. Our hearty condolences to their families and friends. This outbreak can be controlled by our combined effort. Many people don’t understand the importance of social distancing in this crucial time. Here is why it is so important,

Let X be a person who is already infected. X doesn't follow the instructions and get outside of the home to meet people. X meets two people Y and Z on the first day. These two people get infected. Y and Z don't know that they are infected. X, Y, and Z all go to the market the next day. X meets two of his relatives, Y meets two shopkeepers and Z meets two of his friends. So, X, Y, and Z cause six more infections. Total reported infections are 9 by this day. If every infected people causes two more infections each day then the number of total infected people follows the series below:

  • Day = 1, New = 0, Total = 1
  • Day = 2, New = 2, Total = 3
  • Day = 3, New = 6, Total = 9
  • Day = 4, New = 18, Total = 27
  • Day = 5, New = 54, Total = 81
  • Day = 6, New = 162, Total = 243
  • . . .
  • . . .
  • Day = 18, New = 86093442, Total = 129140163
  • Day = 19, New = 258280326, Total = 387420489
  • Day = 20, New = 774840978, Total = 1162261467

After only 20 days total of 1162261467 people are infected. If the first person stayed at home, this number could be 1.

To make people understand, you want to write a program that will take an input N where N is an integer and print the statistics for each of the N days.

Input

First line of the input will contain a single integer T. T denotes the number of test cases.
Each of the next T lines will contain an integer N. N denotes the number of days.

1<=T<=30
1<=N<=30

Output

For each test case print "Case t:" in the first line. t denotes the case number.
Then print N lines "Day = x, New = y, Total = z" where, x is the day, y is the number of new infected cases on this day, z = Total number of infected cases till this day.

Sample

InputOutput
2
3
4
Case 1:
Day = 1, New = 0, Total = 1
Day = 2, New = 2, Total = 3
Day = 3, New = 6, Total = 9
Case 2:
Day = 1, New = 0, Total = 1
Day = 2, New = 2, Total = 3
Day = 3, New = 6, Total = 9
Day = 4, New = 18, Total = 27

    Discussion

    Statistics


    95% Solution Ratio

    jebouinEarliest, Apr '20

    jebouinFastest, 0.0s

    Wojciech.324122Lightest, 0 B

    bokaifShortest, 145B

    Submit

    Login to submit

    Editorial

    Let totali be the number of total infected people till the ith day. So, the number of new infected p...

    Related Contests

    Toph uses cookies. By continuing you agree to our Cookie Policy.