Created
March 3, 2015 18:19
-
-
Save hugoangeles0810/5226378d338162e5d7e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static void main(String[] args) throws java.io.IOException{ | |
java.io.BufferedReader input = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); | |
java.util.ArrayList numeros = new java.util.ArrayList(); | |
//lectura | |
int P = Integer.parseInt(input.readLine()); | |
//variables auxiliares | |
int coc = 0,res = 0; | |
//divisiones entre 60 | |
while (P >=60) { | |
res = P%60; | |
P = P/60; | |
numeros.add(res); | |
} | |
numeros.add(P); | |
//recorrer el array del ultimo al primer elemento | |
//para convertir a numeros babilonios | |
int n = numeros.size()-1,N; | |
String babilonios = ""; | |
for(int i = n; i>=0;i--) { | |
N = Integer.parseInt(numeros.get(i).toString()); | |
babilonios = babilonios +"."+toL(N/10)+toI(N%10); | |
} | |
babilonios = babilonios.substring(1); | |
//mostrar | |
System.out.println(babilonios); | |
} | |
static String toL(int num){ | |
//convierte las centenas | |
String cad = ""; | |
for(int i = 1;i<=num;i++ ){ | |
cad = cad + "L"; | |
} | |
return cad; | |
} | |
static String toI(int num){ | |
//convierte las unidades | |
String cad = ""; | |
for(int i = 1;i<=num;i++ ){ | |
cad = cad + "I"; | |
} | |
return cad; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment