package javatest;import java.util.*;public class javatest{public static void num(int[] inp){for(int i=0;i<inp.length;i++){int temp=inp[i];int cur=0;int re=0;while(temp!=0){cur=temp%3;temp=temp/3;re=re+temp;temp=temp+cur;}if(cur==2)re=re+1;System.out.println(re);}} public static void main(String[] args){Scanner sc=new Scanner(System.in);int[] inp=new int[10];int i=0;while(sc.hasNextInt()){if(sc.nextInt()==0){break;}if(i<10){ inp[i]=sc.nextInt();i++;}elsebreak;}sc.close();num(inp);}}
添加回答
举报
0/150
提交
取消