fork download
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. IDEONE.
  3.  
  4. ENVIRONMENT DIVISION.
  5.  
  6. DATA DIVISION.
  7. WORKING-STORAGE SECTION.
  8. 01 b PIC X(100) .
  9. 01 i PIC 9(3) .
  10. 01 du PIC 9(15) VALUE 0.
  11. 01 dl PIC 9(16) VALUE 0.
  12. 01 d PIC X(31) .
  13. 01 m PIC 9(16) VALUE 1000000000000000.
  14. 01 c PIC 9 .
  15. 01 q PIC 9 .
  16. 01 r PIC 9(16) .
  17.  
  18. PROCEDURE DIVISION.
  19. ACCEPT b
  20. PERFORM VARYING i FROM 1 BY 1 UNTIL i > 100
  21. COMPUTE du = du * 2
  22. COMPUTE dl = dl * 2
  23. MOVE b(i:1) TO c
  24. COMPUTE dl = dl + c
  25. DIVIDE dl BY m GIVING q REMAINDER r
  26. MOVE r TO dl
  27. COMPUTE du = du + q
  28. END-PERFORM.
  29. STRING
  30. du dl
  31. INTO d
  32. END-STRING.
  33. DISPLAY d.
  34. STOP RUN.
  35.  
Success #stdin #stdout 0s 4008KB
stdin
1100011011010101111000000001101110110110011011110010000011000000000111000101101010101010111010101110
stdout
9845854634480680068147265711790