这也能算hard题??利用哈希的思想轻松搞定。
#include <stdio.h>
int main(int argc, char *argv[]) {
int count = 0;
int res[1000];
memset(res, -1, sizeof(res));
scanf("%d", &count);
while (--count >= 0) {
int tmp;
scanf("%d", &tmp);
res[tmp] = tmp;
}
for (int i = 0; i < 1000; ++i) {
if (res[i] != -1) {
printf("%d\n", res[i]);
}
}
return 0;
}