hdu 1029

来源:互联网 发布:千牛工作台有无mac版 编辑:程序博客网 时间:2024/05/10 05:37

虽然题目很简单,但还是看了别人的题解才做出来

#include<iostream>using namespace std;int n,x;int main(){    while (cin>>n)    {        int time = 0, res;        for (int i = 0; i < n; i++){            cin >> x;            if (time == 0){                time++;                res = x;            }            else{                if (res == x)                    time++;                else                    time--;            }        }        cout << res << endl;    }}
0 0
原创粉丝点击