|  | 
|  | 
| back to board | time limit Posted by axel  2 Nov 2008 21:01#include<iostream>#include<stack>
 using namespace std;
 stack < int > s;
 int n,s1;
 int main()
 {
 scanf("%d",&n);
 while(n!=0)
 {                scanf("%d",&s1);
 if(s.empty())s.push(s1);
 else
 {
 if(s1==s.top())s.push(s1);
 else if(!s.empty()) s.pop();
 }
 n--;
 }
 printf("%d\n",s.top());
 return 0;
 }
 | 
 | 
|