@@ -0,0 +1,665 @@
+package greedy;%0A%0Aimport java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Cakewalk %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int n = in.nextInt();%0A        int%5B%5D calories = new int%5Bn%5D;%0A        for(int calories_i=0; calories_i %3C n; calories_i++)%7B%0A            calories%5Bcalories_i%5D = in.nextInt();%0A        %7D%0A        // your code goes here%0A        Arrays.sort(calories);%0A        long miles = 0;%0A        for(int i=n-1; i %3E= 0;i--) %7B%0A            miles += calories%5Bi%5D*Math.pow(2.0, (double)(n-1-i));%0A        %7D%0A        System.out.println(miles);%0A    %7D%0A%7D%0A

add Cakewalk to greedy