/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package lode; import java.lang.Math; import java.util.Scanner; /** * * @author cteam037 */ public class Lode { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner s = new Scanner(System.in); int pocet = s.nextInt(); int pole[] = new int[pocet]; for(int i=0; i 0; i--) { System.out.print(row[i] + " "); } System.out.print(row[0]); System.out.println(""); } public static int[] calculate(int tonnage) { int maxDimension = Lode.maxDimension(tonnage); int[] result = new int[maxDimension+1]; int ostavaNosnosti = tonnage; for(int i=maxDimension; i>=0; i--) { int packageWeight = Lode.weight(i); while((ostavaNosnosti-packageWeight) >= 0) { result[i] += 1; ostavaNosnosti -= packageWeight; } } return result; } public static int maxDimension(int tonnage) { int i = 0; while(true) { if (Lode.weight(i) > tonnage) { return i-1; } i++; } } public static int weight( int dimension ) { int result = 1; for (int i=0; i