fork download
  1. // your code goes here
  2. s = stdIn().grabLine()
  3.  
  4. i = 0
  5. bin = arrayBuffer(100)
  6. dec = arrayBuffer(33)
  7. while i < 100
  8. if s[i] == "0"
  9. bin[i] = 0
  10. else
  11. bin[i] = 1
  12. end
  13. i++
  14. end
  15.  
  16. i = 0
  17. while i < 33
  18. rem = 0
  19. j = 0
  20. while j < 100
  21. rem *= 2
  22. rem += bin[j]
  23. bin[j] = int(rem / 10)
  24. rem %= 10
  25. j++
  26. end
  27. dec[i] = rem
  28. i++
  29. end
  30.  
  31. i = 32
  32. str = ""
  33. while i >= 0
  34. str += dec[i]
  35. i--
  36. end
  37.  
  38. printl(str)
Success #stdin #stdout 0.01s 6396KB
stdin
1000000111101001100001010101000101100101110101111111000101000110010011100110011011101101000101100011
stdout
000643294008947053015977268531555