Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

thanhchauns2's blog

By thanhchauns2, history, 3 years ago, In English

I just want to share something to community, after I found this problem in the problemset (which the answer cannot be display as long long integer). Here is my class to calculate on strings (including add, substract, multiply, divide (as two strings), modulo and take gcd, I will add bitwise operators later if possible).

Hope you will find it useful. If you find this incomplete, I would love to read any feedback.

Code

Hope you will find this helpful ^_^ Thanks for reading.

  • Vote: I like it
  • +24
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

this looks decent, but there's a better way of implementing bigint: splitting the digits into a group of, say, 10 digits or 20 digits, each group then can be displayed as an integer, operations will be faster and much simpler to store (which is how many bigint templates are implemented)