Import Java. io. *; <br/> Import Java. util. *; <br/> Import Java. math. *; <br/> public class mainpku2305 {<br/> static variable in = new variable (New bufferedreader (New inputstreamreader (system. in); <br/> Public static void main (string [] ARGs) {<br/> int B; <br/> while (in. hasnext () {<br/> B = in. nextint (); <br/> If (B = 0) <br/> break; <br/> biginteger P, M; <br/> P = in. nextbiginteger (B); <br/> M = in. nextbiginteger (B); <br/> biginteger ans = P. moD (m); <br/> string STR = ans. tostring (B); <br/> system. out. println (STR); <br/>}< br/>
String ST = integer. tostring (Num, base); // convert num into base (base <= 35 ).
Int num = integer. parseint (St, base); // Use ST as the base and convert it to a 10-digit int (parseint has two parameters, and the first is the string to be converted,
// The second is the description of the hexadecimal format ).
Biginter M = new biginteger (St, base); // st is a string, and base is the base.
1. If you want to read a large number in binary format, you can use cin. nextbiginteger (2 );
Of course, you can also use other hexadecimal methods to read data;
2. If you want to convert a large number to a string in other hexadecimal forms, use cin. tostring (2); // convert it to a string in binary format.