/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author jakab4 */ public class Lode { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); long[] tri = new long[15]; long pom = 1; tri[0] = 1; for(int i=1;i<15;i++) { pom *= 3; tri[i] = pom; } int pocet = sc.nextInt(); for(int i=0; i= tri[j]) { vysledok[j]++; m -= tri[j]; } else { j--; } if(m == 0) { break; } } int priznak = 0; for(int q=14;q>=1;q--) { if(vysledok[q]!=0 || priznak == 1) { System.out.print(vysledok[q] +" "); priznak = 1; } } System.out.print(vysledok[0]); System.out.println(); } } }