#include <stdio.h>
int n, data[101];
char in [3000000];
void input()
{
char ch;
int i, j = 0;
fgets(in, 2999999, stdin);
for (i = 0; (ch = in[i]); i ++)
{
if (ch == ' ' || ch == '\n')
{
data[j] ++;
j = 0;
continue;
}
j = (j * 10) + ch - '0';
continue;
}
}
void output()
{
int index = 0, i, j, now = 0;
for (i = 0; i < 10 && now != n; i ++)
for (;data[i] && now != n; data[i] --, now ++)
{
in[index ++] = i + '0';
in[index ++] = ' ';
continue;
}
for (i = 10; i < 100 && now != n; i ++)
for (;data[i] && now != n; data[i] --, now ++)
{
in[index ++] = (i / 10) + '0';
in[index ++] = (i % 10) + '0';
in[index ++] = ' ';
continue;
}
in[index - 1] = '\n';
in[index] = '\0';
fputs(in, stdout);
}
int main()
{
for (;scanf("%d", &n) == 1 && n;)
{
getchar();
input();
output();
continue;
}
return 0;
}
回目錄
回首頁
沒有留言 :
張貼留言