Coding Type Question
Hitler decided to declare war on Americans so he decided to build a gun on their own. These guns
consist of N pieces of Steel of different length. These must be joined in order to create the gun. The
cost to connect two pieces is equal to some of their lengths. To help Hitler write a program that can
calculate the lowest possible cost to build the Gun.
Input format
Single line input contains the integer N, followed by N elements separated by single space.
Output format
Print the minimum cost.
Code constraints
Queue > 0
Queue < 100
Sample testcases
Input 1
4.5237
Output 1
32
Input 2
Output 2
3.7 85 4
187
Answers
Answered by
1
Explanation:
wdderer
dfg
ghy
yyu
gg
h
j
j
j
k
k
k
I
I
I
u
k
k
koi
j
j
ju.k
Similar questions