AlgorithmOJ
Problem
Local Problems
All Problems
Problem Category
Status
Contest
Standard Contests
Replay Contests
Virtual Contests
Ranklist
More...
News
About
F.A.Q
Recent Contests
Coming Soon...
Login
Register
2026-07-23 06:05:58
寻找独一无二的数
Time Limit:
1000ms
Memory Limit:
32768KB
64-bit integer IO format:
%lld
Java class name:
Main
Prev
Submit
Status
Statistics
Next
Font Size:
Description
现给你一组数,要求你找出其中只出现过一次的那个数。题目保证只有一个数字出现过一次,并且除了只出现一次的那个数字外,其余的数字均出现了偶数次。
Input
输入包含多组测试样例。每组样例第一行为一个正整数n(1<=n<=1000000,并且n为奇数),表示数字的个数。
接下来的一行为n个正整数,所有的数都小于2^31。
当n=0时,输入结束。
Output
输出只出现过一次的那个数字,每组结果占一行。
Sample Input
5 1 1 3 2 2 3 1 2 1 0
Sample Output
3 2
Author
Admin
Language:
C++ (GCC 5.4.0)
C++11 (GCC 5.4.0)
C++14 (GCC 6.3.0)
C (GCC 5.4.0)
Java (OpenJDK 1.8.0)
Pascal (FPC 3.0.0)
Python2 (2.7.12)
Python3 (3.5.2)
Python3 (3.8.2)
C# (Mono 4.2.1)
Fortran
Perl
Ruby
Ada
SML
Visual C++
Visual C
CLang
CLang++
Theme:
Monokai
Solarized Light
Material
Share Code?
Yes
No
×
Login
Username:
Password:
Cookie:
Never
One Day
One Week
One Month
One Year
×
Register
Username:
Password:
Repeat Password:
Nickname:
School:
Email:
×
News Title
by