DAPC23-048.Finding Forks
Medium · 1 s · 256 MB
- icpc
- dapc
- 2023
Your cutlery drawer contains many types of forks. Each with their own purpose, and each with its own place in the cutlery drawer. After a nice dining party with all your friends, disaster struck! You put all the used forks in the dishwasher, but now you are unsure where to put back some of the forks, because at least two places in the cutlery drawer are empty! And worse, you do not remember which type of fork belongs where!
What is the minimum number of forks that must have been in the dishwasher to cause this confusion?
Giriş formatı
The input consists of:
• One line with an integer (), the number of types of forks.
• One line with integers (), the number of forks of each type.
Çıxış formatı
Output the minimum number of forks that must have been in the dishwasher.
Qeyd
Source: Delft Algorithm Programming Contest 2023 · Author: Ragnar Groot Koerkamp · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license.
Nümunələr
Giriş #1
3 4 9 5
Çıxış #1
9
Giriş #2
10 18 39 5 12 1000000000 54 23 11 123 31415
Çıxış #2
16