题意:
给出N个数,要求把其中重复的去掉,只保留第一次出现的数。n≤50000
题解:
一道令管理员都后悔加入的水题,按大小排序后unique,再按读入顺序排序即可。
代码:
1 #include2 #include 3 #include 4 #define inc(i,j,k) for(int i=j;i<=k;i++) 5 using namespace std; 6 7 inline int read(){ 8 char ch=getchar(); int f=1,x=0; 9 while(ch<'0'||ch>'9'){ if(ch=='-')f=-1; ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();10 return f*x;11 }12 int t,n,tot;13 struct nd{ int v,id;};14 bool cmp1(nd a,nd b){ if(a.v!=b.v)return a.v
20160610