1 //用c++的sort可以过 2 #include<stdio.h> 3 int main() 4 { 5 int n; 6 while(~scanf("%d",&n)) 7 { 8 int ans,ant,num=0; 9 while(n--) 10 { 11 scanf("%d",&ant); 12 if(num) 13 if(ans == ant) 14 ++num; 15 else 16 --num; 17 else 18 { 19 ++num; 20 ans = ant; 21 } 22 } 23 printf("%d\n",ans); 24 } 25 }
时间: 2024-10-24 23:45:24