标签:style blog http color strong 数据
1 5 1 4 7 6 2
5
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #include <vector> 6 #include <climits> 7 #include <algorithm> 8 #include <cmath> 9 #define LL long long 10 using namespace std; 11 int d[100010],tot; 12 int main() { 13 int kase,i,n,ans,pre; 14 scanf("%d",&kase); 15 while(kase--) { 16 scanf("%d",&n); 17 for(i = 0; i < n; i++) 18 scanf("%d",d+i); 19 sort(d,d+n); 20 ans = 1; 21 pre = tot = 0; 22 for(i = 1; i < n; i++) { 23 if(d[i] > d[i-1]) ans++; 24 else if(d[i] > pre){ 25 ans++; 26 pre = d[i]; 27 } 28 } 29 printf("%d\n",ans); 30 } 31 return 0; 32 }
标签:style blog http color strong 数据
原文地址:http://www.cnblogs.com/crackpotisback/p/3830523.html