Submit solution
Points:
5 (partial)
Time limit:
2.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Farmer Yunji owns farms. Each farm produces
dollars per day. Due to tax issues, he has to sell
of his farms. What is the maximum amount of money he can earn per day from his farms, after he sells
of them?
Input Specification
The first line will contain two space-separated integers, , the number of farms, and the number of farms Yunji has to sell, respectively.
The next line will contain integers,
.
Output Specification
On the first line, output the maximum amount of money Yunji can make per day after selling of his farms.
Subtasks
Subtask 1 [15%]
.
Subtask 2 [85%]
No further constraints.
Sample Input 1
2 1
8 10
Sample Output 1
10
Sample Input 2
3 3
29 34 12
Sample Output 2
0
Comments
guys, remember to use 2 ^ 63 integer data type to store your sum, using normal 2 ^ 31 integer data types is not enough for this question