fork download
  1. interface Main{static void main(String[]x){
  2. String[] s = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
  3. var v = new java.util.Scanner(System.in);
  4. int ten = v.nextInt();
  5. int base = v.nextInt();
  6. v.close();
  7. int ex =0;
  8. int base1 = base;
  9. while(base1<=ten){
  10. base1=base1*base;
  11. ex++;
  12. }
  13.  
  14. for(;ex>=0;ex--){
  15. base1/=base;
  16. int div = ten/base1;
  17. System.out.print(s[div]);
  18. ten=ten-div*base1;
  19. }
  20.  
  21.  
  22. }}
Runtime error #stdin #stdout #stderr 0.17s 56680KB
stdin
1000000000 36
stdout
Y4Q29
stderr
Exception in thread "main" java.lang.ArithmeticException: / by zero
	at Main.main(Main.java:16)