Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • \$\begingroup\$ The rules say Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time. \$\endgroup\$ Commented Mar 13, 2019 at 14:28
  • \$\begingroup\$ @JoKing Does that mean that I can't use a Java int at all, but rather a BigInteger? Because Java has BigIntegers, but it won't ever have an int that's more than 31 bits as signed, which can't hold any other value than those represented here... \$\endgroup\$ Commented Mar 13, 2019 at 14:30
  • \$\begingroup\$ no, but if the program should still work if the int type was unbounded \$\endgroup\$ Commented Mar 13, 2019 at 21:16
  • 1
    \$\begingroup\$ @JoKing Ok, I switched the two solutions again to have the computation first. \$\endgroup\$ Commented Mar 13, 2019 at 22:35