Sicily 1200. Stick

来源:互联网 发布:电机控制底层算法 编辑:程序博客网 时间:2024/05/16 01:52

其实就是找出唯一的那个奇数个的stick而已,各种方法,任君使用。

Run Time: 0sec
Run Memory: 312KB
Code length: 493Bytes
SubmitTime: 2011-11-30 23:06:39

// Problem#: 1200// Submission#: 1019536// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>#include <set>using namespace std;int main(){    int n, i;    int data;    while ( true ) {        cin >> n;        if ( n == 0 )            break;        set<int> si;        for ( i = 1; i <= n; i++ ) {            cin >> data;            if ( si.find( data ) == si.end() )                si.insert( data );            else                si.erase( data );        }        cout << *si.begin() << endl;    }    return 0;}                                 


 

原创粉丝点击