2005. Lovely Number

By | 04月17日
Advertisement

2005. Lovely Number

Description

Every time after got a solution from kevin, ivan repeats again and again,"Are there any better ones?". It seems more worse this time. Given a sequence of numbers, which ivan is sure that all of them appear even times except only one "lovely number" appears odd times, kevin must find out the lovely number as soon as possible. So, let's rock!

Input

There are multiple test cases.

Each test case contains two lines. The first line is an integer N, 1 <= N <= 10001, and N % 2 = 1. The second line contains N integers, separated by spaces.

Input is terminated by EOF.

Output

For each test case, output a line of an integer, which should be the lovely number.

Sample Input

31 2 157 7 7 7 372 2 4 4 4 2 2

Sample Output

234

Problem Source

2010中山大学新手赛-网络预选赛 ivankevin@argo

#include <iostream> #include <set> using namespace std;  int main() { 	int t; 	while(cin>>t) 	{ 		int temp; 		set<int>myset; 		while(t--) 		{ 			cin>>temp; 			if(myset.count(temp)) 				myset.erase(temp); 			else 			    myset.insert(temp); 		} 		cout<<*myset.begin()<<endl; 	} 	return 0; } 

Similar Posts:

  • 大大

    2013-10-14:Sicily 3718. 批改作业 2013-10-14:Sicily 3499. 分数统计 2013-10-14:Sicily 3497. 水仙花数 2013-10-14:Sicily 3496. 鸡兔同笼 2013-10-14:Sicily 2683. Alice and Bob 2013-10-14:Sicily 2005. Lovely Number 2013-10-14:Sicily 1938. Message Flood 2013-10-14:Sicily 19

  • Working with tempdb in SQL Server 2005

    Published: June 26, 2006 SQL Server Technical Article Writers: Wei Xiao, Matt Hink, Mirek, Sunil Agarwal Technical Reviewer: Wei Xiao Applies To: SQL Server 2005 Summary: This white paper describes how SQL Server 2005 uses tempdb. Many improvements i

  • Codeforces Round #326 (Div. 2) B. Duff in Love 分解质因数

    B. Duff in Love Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/problem/B Description Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such

  • IBM AIX V5.3 系统管理 -- 问题的确定与解决一

    一. 网络问题 在这一部分中,您将了解系统中网络支持和故障诊断的一些重要的方面,包括修改网络适配器和接口.请注意,本部分并没有提供网络支持方面的所有内容(因为网络可能是非常复杂的环境),但是为支持专业人员提供了一个很好的起点. 1.1 ping 命令 ping 命令适用于下列情况: (1)确定网络以及各种外部主机的状态 (2)跟踪和隔离硬件和软件问题 (3)测试.测量和管理网络 ping 命令发送一个 Internet Control Message Protocol (ICMP) ECHO_R

  • CF 588B Duff in Love

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer

  • B. Duff in Love

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integera > 1 such that a

  • 2010年普通高等学校招生全国统一考试英语(福建卷)

    绝密 ★ 启用前 2010年普通高等学校招生全国统一考试(福建卷) 英 语 I 听力(共两节,满分35分) 无 第二部分 英语知识运用(共两节,满分45分) 第一节 单项填空(共15小题:每小题1分,满分15分) 从A.B.C.D四个选项中,选出可以填入空白处的最佳选项,并在答题卡上将该项涂黑. 例:It is generally considered unwise to give a child he or she wants. 答案是B. 21.It's good feeling for p

  • [转]SAP COPA document repost

    文章来源于网络博文,具体博文地址已经忘记了.向作者致谢! KE4S 记帐帐单凭证至CO-PAKE4S00 CO-PA: 行项目冲消KE4SCRM 后续过帐 CRM 开票至 CO-PAKE4SFI CO-PA: 从 FI 后续过帐KE4SMM CO-PA: 后续过帐物料凭证 1.If you want to delete the costing-based COPA document from tableCE1XXXX(XXXX means the operation Concern), you

  • 分解质因数之codeforces_588B

    Description Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a2 is a divisor of x. Malek has a number store! In his store, he has only divisors of positive int

  • Duff in Love(素因子的应用)

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer 

Tags: