SAC '22 Code Challenge 5 P1 - Querying Plants

View as PDF

Submit solution


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

Author:
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?

Constraints

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

5
3
1 2 3 4 5

Sample Output

7 8 9 10 11

Comments


  • 0
    KmiloKun  commented on June 24, 2022, 12:15 a.m.

    whats wrong with my code? :C


    • 3
      FlowerPollinator  commented on June 24, 2022, 12:29 a.m.

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