Here are several questions in 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 DescriptionIn 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.
|
InputThe 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.
|
OutputFor each case, output an integer in a line, which is the card number of your present.
|
Sample Input51 1 3 2 231 2 10
|
Sample Output32 HintHintuse scanf to avoid Time Limit Exceeded |
After using the bucket sorting method and traversing each input one time
Exchange rate.
Exchange Law result ^ 1 ^ 1 ^ 2 ^ 2 ^ 3
Binary 101)
AC code:
# Include <stdio. h> # include <. h> (scanf (, & n )! = (N = res = (I =; I <n; I ++ scanf (, & res = res ^ printf (}View Code
Sort |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) |
Total Submission (s): 3499 Accepted Submission (s): 1008 |
|
Problem Description: enter a number in a row. If we regard '5' in this row as a space, several non-negative integers (some integers may start with '0, the '0' of these headers should be ignored unless the integer is composed of several '0' and the integer is 0 ).
Your task is to sort the generated integers in ascending order.
|
The Input contains multiple groups of test cases. Each group of Input data has only one row of numbers (no space between numbers), and the length of this line of numbers is not greater than 1000.
Input data guarantee: The calculated non-negative integer is not greater than 100000000, and the input data cannot all be composed of '5.
|
For each test case, Output results are sorted by integers. Two Adjacent integers are separated by a space. Each group occupies one row.
|
Sample Input0051231232050775
|
Sample Output0 77 12312320 |
If it is 005123123205077555555555
The output is also 0 77 12312320
WA is easy to consider.
AC code:
# Include <stdio. h> # include <. h> a [n [k = ti = tmp = len = (I = len-; I >=; I -- (I = len-& n [I] = (n [I] = (n [I +] = a [k] = k ++ ti = tmp = (I = & n [I]! = Tmp + = ti * (n [I]-ti * = a [k] = k ++ ti = tmp + = ti * (n [I]-ti * = (I =; I <k; I ++ (j = k-; j> = I; j -- (a [j] <a [j-tmp = a [j]; a [j] = a [j-]; a [j-] = (I =; I <k; I ++ (I <k-printf (}View Code