fork(1) download
  1. // ... (126)
  2. long long g(x,r){return r--<0?0:g(x,r)-g(x/=r=r*8/7*3/2*2+5)*r+(x+1LL)*x*r/2;}main(t){printf("%jd\n%jd",g(t=1e5),g(t=1e9,9));}
  3. //----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2----+----3
  4. #if 0
  5. disassembled code:
  6. 8048510 <g>:
  7. 8048510: 55 push %ebp
  8. 8048511: 57 push %edi
  9. 8048512: 31 c0 xor %eax,%eax
  10. 8048514: 56 push %esi
  11. 8048515: 53 push %ebx
  12. 8048516: 31 d2 xor %edx,%edx
  13. 8048518: 83 ec 2c sub $0x2c,%esp
  14. 804851b: 8b 4c 24 44 mov 0x44(%esp),%ecx
  15. 804851f: 85 c9 test %ecx,%ecx
  16. 8048521: 0f 88 f1 00 00 00 js 8048618 <g+0x108>
  17. 8048527: 8d 59 ff lea -0x1(%ecx),%ebx
  18. 804852a: 83 ec 08 sub $0x8,%esp
  19. 804852d: 53 push %ebx
  20. 804852e: ff 74 24 4c pushl 0x4c(%esp)
  21. 8048532: e8 d9 ff ff ff call 8048510 <g>
  22. 8048537: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx
  23. 804853e: 89 c7 mov %eax,%edi
  24. 8048540: 89 d5 mov %edx,%ebp
  25. 8048542: ba 93 24 49 92 mov $0x92492493,%edx
  26. 8048547: 89 c8 mov %ecx,%eax
  27. 8048549: f7 ea imul %edx
  28. 804854b: 01 ca add %ecx,%edx
  29. 804854d: c1 f9 1f sar $0x1f,%ecx
  30. 8048550: c1 fa 02 sar $0x2,%edx
  31. 8048553: 29 ca sub %ecx,%edx
  32. 8048555: 8d 04 52 lea (%edx,%edx,2),%eax
  33. 8048558: 89 c3 mov %eax,%ebx
  34. 804855a: c1 eb 1f shr $0x1f,%ebx
  35. 804855d: 01 d8 add %ebx,%eax
  36. 804855f: 83 e0 fe and $0xfffffffe,%eax
  37. 8048562: 8d 58 05 lea 0x5(%eax),%ebx
  38. 8048565: 8b 44 24 50 mov 0x50(%esp),%eax
  39. 8048569: 99 cltd
  40. 804856a: f7 fb idiv %ebx
  41. 804856c: 89 04 24 mov %eax,(%esp)
  42. 804856f: 89 c6 mov %eax,%esi
  43. 8048571: e8 9a ff ff ff call 8048510 <g>
  44. 8048576: 89 d9 mov %ebx,%ecx
  45. 8048578: 83 c4 10 add $0x10,%esp
  46. 804857b: 89 54 24 18 mov %edx,0x18(%esp)
  47. 804857f: c1 f9 1f sar $0x1f,%ecx
  48. 8048582: 8b 54 24 18 mov 0x18(%esp),%edx
  49. 8048586: 89 74 24 10 mov %esi,0x10(%esp)
  50. 804858a: 89 4c 24 0c mov %ecx,0xc(%esp)
  51. 804858e: 89 f1 mov %esi,%ecx
  52. 8048590: 89 5c 24 08 mov %ebx,0x8(%esp)
  53. 8048594: c1 f9 1f sar $0x1f,%ecx
  54. 8048597: 89 4c 24 14 mov %ecx,0x14(%esp)
  55. 804859b: 8b 4c 24 0c mov 0xc(%esp),%ecx
  56. 804859f: 0f af d3 imul %ebx,%edx
  57. 80485a2: 0f af c8 imul %eax,%ecx
  58. 80485a5: 01 d1 add %edx,%ecx
  59. 80485a7: f7 e3 mul %ebx
  60. 80485a9: 01 ca add %ecx,%edx
  61. 80485ab: 29 c7 sub %eax,%edi
  62. 80485ad: 8b 4c 24 14 mov 0x14(%esp),%ecx
  63. 80485b1: 19 d5 sbb %edx,%ebp
  64. 80485b3: 8b 54 24 10 mov 0x10(%esp),%edx
  65. 80485b7: 8b 44 24 14 mov 0x14(%esp),%eax
  66. 80485bb: 89 7c 24 18 mov %edi,0x18(%esp)
  67. 80485bf: 89 6c 24 1c mov %ebp,0x1c(%esp)
  68. 80485c3: 83 c2 01 add $0x1,%edx
  69. 80485c6: 83 d1 00 adc $0x0,%ecx
  70. 80485c9: 89 54 24 10 mov %edx,0x10(%esp)
  71. 80485cd: 89 4c 24 14 mov %ecx,0x14(%esp)
  72. 80485d1: 0f af ce imul %esi,%ecx
  73. 80485d4: 0f af c2 imul %edx,%eax
  74. 80485d7: 89 cf mov %ecx,%edi
  75. 80485d9: 01 c7 add %eax,%edi
  76. 80485db: 8b 44 24 10 mov 0x10(%esp),%eax
  77. 80485df: f7 e6 mul %esi
  78. 80485e1: 8b 74 24 0c mov 0xc(%esp),%esi
  79. 80485e5: 01 fa add %edi,%edx
  80. 80485e7: 89 c7 mov %eax,%edi
  81. 80485e9: 0f af f0 imul %eax,%esi
  82. 80485ec: 89 d0 mov %edx,%eax
  83. 80485ee: 0f af c3 imul %ebx,%eax
  84. 80485f1: 01 c6 add %eax,%esi
  85. 80485f3: 89 f8 mov %edi,%eax
  86. 80485f5: 31 ff xor %edi,%edi
  87. 80485f7: f7 e3 mul %ebx
  88. 80485f9: 89 d1 mov %edx,%ecx
  89. 80485fb: 01 f1 add %esi,%ecx
  90. 80485fd: 89 ce mov %ecx,%esi
  91. 80485ff: c1 ee 1f shr $0x1f,%esi
  92. 8048602: 01 c6 add %eax,%esi
  93. 8048604: 11 cf adc %ecx,%edi
  94. 8048606: 89 f0 mov %esi,%eax
  95. 8048608: 89 fa mov %edi,%edx
  96. 804860a: 0f ac d0 01 shrd $0x1,%edx,%eax
  97. 804860e: d1 fa sar %edx
  98. 8048610: 03 44 24 18 add 0x18(%esp),%eax
  99. 8048614: 13 54 24 1c adc 0x1c(%esp),%edx
  100. 8048618: 83 c4 2c add $0x2c,%esp
  101. 804861b: 5b pop %ebx
  102. 804861c: 5e pop %esi
  103. 804861d: 5f pop %edi
  104. 804861e: 5d pop %ebp
  105. 804861f: c3 ret
  106. 8048620 <main>:
  107. 8048620: 83 ec 24 sub $0x24,%esp
  108. 8048623: 6a 09 push $0x9
  109. 8048625: 68 00 ca 9a 3b push $0x3b9aca00
  110. 804862a: e8 e1 fe ff ff call 8048510 <g>
  111. 804862f: c7 04 24 a0 86 01 00 movl $0x186a0,(%esp)
  112. 8048636: 89 44 24 18 mov %eax,0x18(%esp)
  113. 804863a: 89 54 24 1c mov %edx,0x1c(%esp)
  114. 804863e: e8 cd fe ff ff call 8048510 <g>
  115. 8048643: 59 pop %ecx
  116. 8048644: ff 74 24 18 pushl 0x18(%esp)
  117. 8048648: ff 74 24 18 pushl 0x18(%esp)
  118. 804864c: 52 push %edx
  119. 804864d: 50 push %eax
  120. 804864e: 68 30 87 04 08 push $0x8048730
  121. 8048653: e8 48 fd ff ff call 80483a0 <printf@plt>
  122. 8048658: 83 c4 3c add $0x3c,%esp
  123. 804865b: c3 ret
  124. #endif
Runtime error #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
3469796305
347147851533059033