Editorial for JDCC '15 Contest 2 P1 - Lifting Weights


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

The amount of weight that Lily can lift grows linearly. This means that we can develop a linear equation of how much she is able to lift in the form of:

\(y = Bx + A\)

Where \(B\) is how much more she can lift every week, and \(A\) is how much she can lift at the start.

The only trick to this problem is to note that we don't add \(B\) to the amount she can lift \(N\) times, as Lily's doesn't get stronger until the second week. So, we have \(x = N - 1\).

The final output for each test case is \(B \times (N - 1) + A\).

Time Complexity: \(\mathcal{O}(1)\)


Comments

There are no comments at the moment.