Guest User

Untitled

a guest
Mar 18th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.util.TreeMap;
  2. public class MyClass {
  3. static TreeMap<Integer, String> a = new TreeMap<Integer, String>();public static void main(String args[]) {a.put(1000, "M");a.put(900, "CM");a.put(500, "D");a.put(400, "CD");a.put(100, "C");a.put(90, "XC");a.put(50, "L");a.put(40, "XL");a.put(10, "X");a.put(9, "IX");a.put(5, "V");a.put(4, "IV");a.put(1, "I");System.out.print(b(44));}static String b(int n){int n1=a.floorKey(n);if(n==n1)return a.get(n);return(a.get(n1) + b(n-n1));}
  4. }
Add Comment
Please, Sign In to add comment