@@ -0,0 +1,645 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=8707%0A%0Apublic class AverageCandyLifetime %7B%0A%09public static double getAverage(int%5B%5D eatenCandies) %7B%0A%09%09double average = 0.0d;%0A%09%09int candyLifetime = 0;%0A%09%09int numberOfCandies = 0;%0A%09%09%0A%09%09int%5B%5D monthLength = new int%5B%5D %7B 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 %7D;%0A%09%09%0A%09%09for (int i = 0; i %3C eatenCandies.length; ++i) %7B%0A%09%09%09if (eatenCandies%5Bi%5D %3E 0) %7B%0A%09%09%09%09for (int j = 0; j %3C= i; ++j) %7B%0A%09%09%09%09%09candyLifetime += monthLength%5Bj%5D * eatenCandies%5Bi%5D;%0A%09%09%09%09%09%0A%09%09%09%09%7D%0A%09%09%09%09numberOfCandies += eatenCandies%5Bi%5D;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%7D%0A%09%09%0A%09%09average = (double) candyLifetime / numberOfCandies;%0A%09%09%0A%09%09return average;%0A%09%7D%0A%7D%0A

Create AverageCandyLifetime.java