hdu 2095 非异或 代码

来源:互联网 发布:熊猫弹幕机器人 软件 编辑:程序博客网 时间:2024/05/20 19:33
水题一道, 只是网上 流传 只有异或的方法, 觉得应该用更具有推广价值的代码。
#include<cstdio>#include<set>using namespace std;set<int>t;int main(){    int n,i,temp;    while(scanf("%d",&n),n!=0)    {        t.clear();        for(i=0;i<n;i++)        {            scanf("%d",&temp);            if(t.count(temp)) t.erase(temp);            else t.insert(temp);        }        printf("%d\n",*t.begin());    }}

1 0
原创粉丝点击