SAC '22 Code Challenge 5 P1 - Querying Plants

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem type

To compensate for the lack of plant life at SAC, Mr. DeMello has taken up gardening!

More specifically, he has N plants that each have a height, H_i, in centimetres.

Every time he waters his plants, all of them grow C centimetres taller.

Given that Mr. DeMello teaches a math course, he forgot his addition tables and asked you to calculate the new lengths of the plants after watering them twice.

Can you help Mr. DeMello?


1 \le N, H_i, C \le 100

Input Specification

The first line will contain an integer, N, the number of plants Mr. DeMello cares for.

The second line will contain an integer, C, the length that the plants grow after being watered once.

The third line will contain N space-separated integers, H_i, representing the initial heights of the plants.

Output Specification

Output N integers, the new heights of the plants after being watered twice in centimetres.

Sample Input

1 2 3 4 5

Sample Output

7 8 9 10 11


  • -2
    KmiloKun  commented on June 23, 2022, 8:15 p.m.

    whats wrong with my code? :C

    • 1
      FlowerPollinator  commented on June 23, 2022, 8:29 p.m.

      try using list(map(int, input().split())) to get the numbers in the input instead of replacing.