在這裡放幾道Steps裡的題目把。
find your present (2)
Time Limit: 1000/2000 MS (Java/Others) Memory Limit: 32768/1024 K (Java/Others)
Total Submission(s): 4570 Accepted Submission(s): 1343
Problem Description
In the new year party, everybody will get a "special present".Now
it's your turn to get your special present, a lot of presents now
putting on the desk, and only one of them will be yours.Each present has
a card number on it, and your present's card number will be the one
that different from all the others, and you can assume that only one
number appear odd times.For example, there are 5 present, and their card
numbers are 1, 2, 3, 2, 1.so your present will be the one with the card
number of 3, because 3 is the number that different from all the
others.
Input
The input file will consist of several cases.
Each case will
be presented by an integer n (1<=n<1000000, and n is odd) at
first. Following that, n positive integers will be given in a line, all
integers will smaller than 2^31. These numbers indicate the card numbers
of the presents.n = 0 ends the input.
Output
For each case, output an integer in a line, which is the card number of your present.
Sample Input
5
1 1 3 2 2
3
1 2 1
0
Sample Output
3
2
Hint
Hint
use scanf to avoid Time Limit Exceeded
在使用桶排序、每輸入一次往上遍歷的方法後依然
交換率。
交換律 result^1^1^2^2^3
二進制 101)
AC代碼:
View Code
排序
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3499 Accepted Submission(s): 1008
Problem Description
輸入一行數字,如果我們把這行數字中的‘5’都看成空格,那麼就得到一行用空格分割的若干非負整數(可能有些整數以‘0’開頭,這些頭部的‘0’應該被忽略掉,除非這個整數就是由若干個‘0’組成的,這時這個整數就是0)。
你的任務是:對這些分割得到的整數,依從小到大的順序排序輸出。
Input
輸入包含多組測試用例,每組輸入數據只有一行數字(數字之間沒有空格),這行數字的長度不大於1000。
輸入數據保證:分割得到的非負整數不會大於100000000;輸入數據不可能全由‘5’組成。
Output
對於每個測試用例,輸出分割得到的整數排序的結果,相鄰的兩個整數之間用一個空格分開,每組輸出占一行。
Sample Input
0051231232050775
Sample Output
0 77 12312320
如果是005123123205077555555555
輸出也是 0 77 12312320
如果此處不特殊考慮容易WA
AC代碼:
View Code