search
HomeDatabaseMysql Tutorialhdu 2095 find your present (2) 找到只出现一次的数字

find your present (2) Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/1024 K (Java/Others) Total Submission(s): 15349Accepted Submission(s): 5821 Problem Description In the new year party, everybody will get a special present.Now

find your present (2)

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/1024 K (Java/Others)
Total Submission(s): 15349    Accepted Submission(s): 5821


Problem Description

In the new year party, everybody will get a "special present".Now it's your turn to get your special present, a lot of presents now putting on the desk, and only one of them will be yours.Each present has a card number on it, and your present's card number will be the one that different from all the others, and you can assume that only one number appear odd times.For example, there are 5 present, and their card numbers are 1, 2, 3, 2, 1.so your present will be the one with the card number of 3, because 3 is the number that different from all the others.

 


Input

The input file will consist of several cases. 
Each case will be presented by an integer n (1

 


Output

For each case, output an integer in a line, which is the card number of your present.

 


Sample Input

<p>5
1 1 3 2 2
3
1 2 1
0</p>

 


Sample Output

<p>3
2</p>


数据有点水, 不符合要求的都是成对出现,所以有人用位运算^给A了  

我是用map做, 之前还想排序下搞,发现内存限制,,,, 1024*1024 / 4=262144   无法满足要存的10^6

所以,只能map了.

#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	int n,i,a;
	map<int>my;
	map<int>::iterator it;
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n scanf my for if>second==1)
			{
				printf("%d\n",it->first);
				break;
			}
		}
		my.clear();
	}
	return 0;
}</n></int></int></map></algorithm></stdio.h>


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
C程序以找到链表的长度C程序以找到链表的长度Sep 07, 2023 pm 07:33 PM

链接列表使用动态内存分配,即它们相应地增长和收缩。它们被定义为节点的集合。这里,节点有两部分,即数据和链路。数据、链接和链表的表示如下-链表的类型链表有四种类型,如下:-单链表/单链表双/双向链表循环单链表循环双链表我们使用递归方法求链表长度的逻辑是-intlength(node*temp){&nbsp;&nbsp;if(temp==NULL)&nbsp;&nbsp;&nbsp;returnl;&nbsp;&nbsp;else{&n

Win10如何找到ATA控制器Win10如何找到ATA控制器Jul 02, 2023 pm 02:05 PM

Win10如何找到ATA控制器?设备管理器中ideata/atapi控制器是计算机内并行ATA接口的扩展。ATA也被称为IDE接口,ATAPI是CD/DVD和其它驱动器的工bai业标准的ATA接口。ATAPI是一个软件接口,它将SCSI/ASPI命令调整到ATA接口上,这使得光驱制造商能比较容易的将其高端的CD/DVD驱动器产品调整到ATA接口上。很多小伙伴不知道怎么详细操作,小编下面整理了Win10找到ATA控制器技巧,如果你感兴趣的话,跟着小编一起往下看看吧!  Win10找到ATA控制器技

OPPO Find X7 绝绝子!用影像定格你的每一刻OPPO Find X7 绝绝子!用影像定格你的每一刻Aug 07, 2024 pm 07:19 PM

在这个快节奏的时代,OPPOFindX7可以用它的影像力量,让我们去细细品味生活中的每一个美好瞬间。无论是壮丽的山川湖海,还是温馨的家庭聚会,亦或是街头的偶遇与惊喜,它都能以"绝绝子"的画质,帮你记录下来。从外头看,在摄像头Deco的设计上,FindX7与Ultra版如出一辙,采用了同心圆弧的造型,参考了专业相机镜头的全棱线设计,还有经典的哈苏"H"大logo,整体看起来很有辨识度,也很有高级感。而内里也是一绝,首先是基础的硬件配置。FindX7维持了上一

Bash程序以找到A的B次方?Bash程序以找到A的B次方?Aug 30, 2023 pm 09:01 PM

这里我们将看到如何使用bash脚本获得数字A的B次方。逻辑很简单。我们必须使用“**”运算符或幂运算符来执行此操作。让我们看下面的程序来清楚地理解这个概念。示例#!/bin/bash#GNUbashScripta=5b=6echo"$(($a**$b))"输出15625

OPPO Find X8 Ultra 核心配置曝光!骁龙 8 Gen4+ 超大电池OPPO Find X8 Ultra 核心配置曝光!骁龙 8 Gen4+ 超大电池Aug 22, 2024 pm 06:54 PM

8月22日,有数码博主透露了OPPOFindX8Ultra的一些核心配置信息。根据曝光的内容,这款高端机型将搭载高通最新的骁龙8Gen4移动平台,配备6000mAh超大容量电池,并支持100W有线快充和50W无线快充功能。外观设计目前尚未有关于OPPOFindX8Ultra的具体外观设计信息。但标准版OPPOFindX8的真机图片已经在网络上曝光。FindX8外观从曝光的照片来看,OPPOFindX8的后置摄像头模组采用了方形设计,四个角带有一定的弧度,给人一种更加圆润的感觉。此外,该机采用了直

Python中的字符串查找和替换技巧有哪些?Python中的字符串查找和替换技巧有哪些?Oct 20, 2023 am 11:42 AM

Python中的字符串查找和替换技巧有哪些?(具体代码示例)在Python中,字符串是一种常见的数据类型,我们在日常编程中经常会遇到字符串的查找和替换操作。本文将介绍一些常用的字符串查找和替换技巧,并配以具体的代码示例。查找子串在字符串中查找特定的子串可以使用字符串的find()方法或者index()方法。find()方法返回子串在字符串中第一次出现的位置索

复制的东西在哪里可以找到复制的东西在哪里可以找到Feb 09, 2024 pm 10:18 PM

在使用电脑的时候我们可以通过快捷键来复制内容,有的用户使用的久了比较好奇了复制的东西在哪里可以找到呢?下面就来看一下小编带来的复制的东西粘贴方法吧。复制的东西在哪里可以找到答案:【开始图标】-【设置】-【系统】-【剪贴板】-【开启剪贴板历史记录】-【按住Windows+V查看】。具体步骤:首先,打开电脑,在左下角找到【开始图标】并点击。接着弹出一个对话框,点击【设置】选项。2、然后在设置的页面中可以看到有系统、个性化、游戏、更新和安全等功能,在这里我们点击【系统】设置;3、接着来到系统设置的页面

C程序用于找到一个数的最大质因子C程序用于找到一个数的最大质因子Aug 27, 2023 am 10:09 AM

PrimeFactor&minus;Innumbertheory,theprimefactorsofapositiveintegeraretheprimenumbersthatdividethatintegerexactly.Theprocessoffindingthesenumbersiscalledintegerfactorization,orprimefactorization.Example&minus;Primefactorsof288are:288=2x2x2x2x2

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft