原题:
Time Limit: 1.0 Seconds Memory Limit: 65536K Total Runs: 3234 Accepted Runs: 1704
Several players play a game. Each player chooses a certain number, writes it down (in decimal notation, without leading zeroes) and sorts the digits of the notation in non-decreasing order, obtaining another number. The player who receives the largest number wins.
You are given the list of numbers initially chosen by the players. Output the winner's resulting number.
Input
The first line of each test case contains an integer N (1 ≤ N ≤ 50), indicating the number of the players. Then N integers followed in the second line. Each number will be between 0 and 100000, inclusive.The input is terminated with N = 0.
Output
Output one line for each test case, indicating the winner's resulting number.
Sample Input
61 10 100 1000 10000 10000039638 8210 3310
Sample Output
13689
Source:
1 #include2 #include 3 #include 4 using namespace std; 5 6 int num[55]; 7 int b[55]; 8 9 int main() {10 int N;11 memset(b, 0, sizeof(b));12 while (cin >> N && N != 0) {13 for (int k = 0; k < N; k++) {14 memset(num, 0, sizeof(num));15 int n, count = 0; cin >> n;16 for (int i = 0; i < 10; i++) {17 num[i] = n % 10;18 n /= 10; count++;19 if (n == 0) break;20 }21 sort(num, num + count);22 //9for (int i = 0; i < count; i++) cout << "num["< <<"] "< <