Submit | All submissions | Best solutions | Back to list |
EICLEANU - Clean up! |
Dat is a mischievous kid and often throws all of the toys in the box out. Dat's brother Tu always had to clean every day, getting bored, so today he doesn't clean in the usual way anymore.
Tu wanted to know that if only one toy was brought back to the box each time, how many steps would Tu need to take all the toys knowing that Tu was standing next to the box.
Input
The first line is the number N, the number of toys Dat has thrown.(1 <= N <= 10^6)
Line 2 contains N non-negative integers that are not exceed 10^6, is the number of steps from the toy box to the thrown items.
Output
The total number of steps Tu needs to take.
Example
Input:34 8 103 4 8 10 Output: 44
Added by: | Ha Minh Ngoc |
Date: | 2016-09-23 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |