Type: Default 2000ms 512MiB

唯一元素的和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

给定一个包含n个元素的列表,请找出列表中所有只出现一次的元素之和。 例如: n=6,列表为[1, 2, 3, 1, 2, 4], 只出现一次的元素是3和4,它们的和是7。

Input Format

第一行一个正整数,为原列表的元素个数n(1<=n<=100); 第二行,以字符串形式输入n个正整数(大小在1~10范围内),相邻两个正整数用一个空格分隔。

Output Format

一个正整数,表示列表中所有只出现一次的元素之和。

6
1 2 3 1 2 4
7

Hint

s = input() #输入一个字符串,赋值给s a = s.split(' ') #将字符串s按空格拆分,保存到列表a中 lis = [int(i) for i in a] #将列表a的元素转换成整数,保存到列表lis中

位运算

Not Claimed
Status
Done
Problem
8
Open Since
2026-1-8 0:00
Deadline
2026-1-15 23:59
Extension
24 hour(s)