The question is this:
Give a bunch of numbers (not QQ number), according to the following rules can find QQ number:
First the first number is deleted, and then the second number is placed at the end of the string, the third number is deleted, and the fourth number is placed at the end of this string of numbers ...
So loop, know the last number left, and delete the last number
According to the order just removed, the number of these numbers together is the goddess QQ number.
Public Static voidMain (string[] arg0)throwsException {String QQ= "631758924"; String REALLYQQ= ""; String Temp= ""; intindex = 0; Queue<String> qqlist =NewLinkedlist<string>(); for(inti = 0; I < qq.length (); i++) {Qqlist.add (string.valueof (Qq.charat (i))); } while(temp = Qqlist.poll ())! =NULL) { if(index% 2 = = 0) {reallyqq+=temp; } Else{qqlist.add (temp); } Index++; } System.out.println (REALLYQQ);//615947283 }
"Find the Goddess to qq number"--java article