andy6804tw
8/16/2016 - 5:02 AM

## https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1042 這題就是就是把每個除出來的數字除到剩二位為止,利用疊代直到0為止 當輸入0時

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1042

``````import java.util.*;

public class Main {

public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int count=1;
while(scn.hasNext()){
long num=scn.nextLong(),arr[][]=new long [4][2];
System.out.printf("%4d.",count++);
call(num);
if(num==0)
System.out.print(" 0");
System.out.println();
}
}
public static void call(long num){
if( num == 0 ) return;
if(num/10000000>0){
call(num/10000000);
System.out.print(" kuti");
num%=10000000;
}
if(num/100000>0){
call(num/100000);
System.out.print(" lakh");
num%=100000;
}
if(num/1000>0){
call(num/1000);
System.out.print(" hajar");
num%=1000;
}
if(num/100>0){
call(num/100);
System.out.print(" shata");
num%=100;
}
if(num!=0)
System.out.print(" "+num);
}
/*
題目：Q10101 - Bangla Numbers
作者：1010
時間：西元 2016 年 8 月 */
} ``````