Online Course Discussion Forum

USACO: Is there a java type that has a big capacity and can do the bitwise shift operator?

 
 
WangDr. Kevin的头像
Re: USACO: Is there a java type that has a big capacity and can do the bitwise shift operator?
WangDr. Kevin - 2023年01月27日 Friday 14:07
 

Be careful when the length of the reversal is odd; the result may be different from what you think.

If the bitwise operation for long strings of 0s and 1s is critical to your algorithm, you could write a helper class to represent that data type. In the helper class, represent the big capacity string with an array of long, and write methods for add digit, shift, complement, bitwise AND, bitwise OR, etc.