Category:0J---Hdu动态规划
Article From:https://www.cnblogs.com/shixinzei/p/9062302.html

Idea: the ordinary CIN can get out of time

 1 #include<iostream>
 2 #include<algorithm>
 3 #include<string>
 4 #include<cstring>
 5 #include<cmath>
 6 using namespace std;
 7 int main()
 8 {
 9     std::ios::sync_with_stdio(false);
10     int n;
11     while(cin>>n){
12         int x,num,t=0;
13         for(int i=0;i<n;i++){
14             cin>>x;
15             if(t==0){
16                 t=1;
17                 num=x;
18             }
19             else{
20                 if(x==num) t++;
21                 else t--;
22             }
23         }
24         cout<<num<<endl;
25     }
26     return 0;
27 }

 

Leave a Reply

Your email address will not be published. Required fields are marked *