题解 | #字符串最后一个单词的长度#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
利用哈希解决
#include <stdio.h>
int main()
{
int val[500] = {0};
int n = 0;
int numArr[500] = {0};
int num = 0;
while(scanf("%d", &n) != EOF) {
for(int i = 0;i < n;i++) {
scanf("%d", &num);
if (val[num] == 0) {
val[num] = 1;
}
}
for (int i = 0;i < 500; i++) {
if(val[i] == 1) {
val[i] = 0;
printf("%d\n", i);
}
}
//printf("\n");
}
}