HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC - 2013-2014 > problem:


2013-03-20. 50589 - The Number of Eggs Sold

IMPC - 2013-2014

Start: Mar.16.2013 at 12:00:00 PM
Finish: Mar.16.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 14-05-80. 50372 - Number Quadrup...
• 14-05-90. 50549 - k-Nearest Neigh...
• 14-05-95. 50479 - Bit Compressor
• 14-07-10. 50383 - Noisy Mornings
• 14-07-20. 50384 - Permutations revi...
• 14-07-30. 50385 - The 3n + 1 problem
• 14-07-50. 50367 - Bar Codes
• 2013-03-10. 50579 - Pentagonal Nu...
• 2013-03-20. 50589 - The Numb...
• 2013-03-30. 50559 - Prime Factors ...
• 2013-03-40. 50685 - Guest Room U...
• 2013-04-10. 50335 - Five Math Ope...
• 2013-04-100. 50323 - Filtering Cont...
• 2013-04-30. 50337 - Exam Averages
• 2013-04-40. 50338 - Convert Into ...
• 2013-04-50. 50774 - Hot Potato
• 2013-04-70. 50296 - Total Discount...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 4000/7000/7000/7000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

The Number of Eggs Sold

Shqip

Farmer Alban Shehu has a chicken farm. The chickens give several eggs everyday. Everyday, farmer Shehu keeps some of the eggs for home use (k) and he sells the rest to a shop. If the number of eggs that he has collected on that day is less than the number of eggs for home use (k), he keeps all the eggs for that day. If the number of the eggs is more than k, he keeps k eggs for home use and sells the rest.

Write a program that is going to calculate the number of eggs sold to the shop.

Input specification
The first line contains three numbers: the number of days (n), the numbers eggs (k) kept for home use, and the number of chickens in the farm (m) where 2 ≤ n ≤ 10000;    0 ≤ k ≤100;   and 0 ≤ m ≤ 1000. The following line contains n space separated numbers where each of the numbers is between 0 and m .

Output specification
Show the number of eggs sold to the shop at the end of n days.

Sample Input:
  7 3 9
  5 2 3 7 5 6 9

Sample Output:
  17

Output Explanation:

  • On the first day farmer Shehu has collected 5 eggs. He kept 3 for home use and he has sold 2 eggs to the shop
  • On the second day farmer Shehu has collected 2 eggs and he kept all for home use
  • On the third day farmer Shehu has collected 3 eggs and he kept all for home use
  • On the fourth day farmer Shehu has collected 7 eggs He kept 3 for home use, so he has 4 sold to the shop
  • etc.


Для отправки решений необходимо выполнить вход.

www.contester.ru