Test instructions: string with N and a string (can have spaces) encoded n times
Encoding: Each character of the string is converted into ASCII code, and ASCII code is converted to 8-bit 2-binary,
The binary number is divided into 6 bits (not enough for 0), and then the decimal number is converted into letters in the following way
After the conversion to a letter, if the length is not an integer multiple of 4, after the string to fill =
For example, the ASCII code of the 84,104,101 turns into 8-bit 2 binary for 01010100,01101000,01100101
Divided into 6 bits for the 010101,000110,100001,100101
The decimal is 21,6,33,37, respectively.
The letters in the table are VGHL.
So the code once was VGHL
Although the test instructions is very troublesome, but the code is very simple ~ two lines is enough
Code:
1 ImportJava.io.*;2 ImportJava.util.*;3 Importjava.math.*;4 Importjava.nio.charset.StandardCharsets;5 6 Public classMain7 {8 Public Static voidMain (string[] args)9 {TenScanner in=NewScanner (system.in); One intT, Ca=1; At=in.nextint (); - while((t--)!=0) - { the intN; -n=in.nextint (); - String S; -s=in.nextline (); +S=s.substring (1); -System.out.print ("Case #" + Ca + ":"); +ca++; A for(inti=0;i<n;i++) at { - byte[] tmp=s.getbytes (STANDARDCHARSETS.US_ASCII); -s=Base64.getencoder (). encodetostring (TMP); - } - System.out.println (s); - } in } -}
Base64
[java]2015 Shanghai Invitational B Base64