Home Database Mysql Tutorial hdu 2095 find your present (2) 找到只出现一次的数字

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

Jun 07, 2016 pm 03:01 PM
find your turn up

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>
Copy after login

 


Sample Output

<p>3
2</p>
Copy after login


数据有点水, 不符合要求的都是成对出现,所以有人用位运算^给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>
Copy after login


Statement of this Website
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

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 Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

C program to find length of linked list C program to find length of linked list Sep 07, 2023 pm 07:33 PM

Linked lists use dynamic memory allocation, i.e. they grow and shrink accordingly. They are defined as collections of nodes. Here, a node has two parts, data and links. The representation of data, links and linked lists is as follows - Types of linked lists There are four types of linked lists, as follows: - Single linked list/Singly linked list Double/Doubly linked list Circular single linked list Circular double linked list We use the recursive method to find the length of the linked list The logic is -intlength(node *temp){ if(temp==NULL) returnl; else{&n

How to find the ATA controller in Win10 How to find the ATA controller in Win10 Jul 02, 2023 pm 02:05 PM

How to find the ATA controller in Win10? The ideata/atapi controller in the device manager is an extension of the parallel ATA interface in the computer. ATA is also called the IDE interface, and ATAPI is the industry standard ATA interface for CD/DVD and other drives. ATAPI is a software interface that adapts SCSI/ASPI commands to the ATA interface. This makes it easier for optical drive manufacturers to adapt their high-end CD/DVD drive products to the ATA interface. Many friends don’t know how to operate in detail. The editor below has compiled the tips for finding the ATA controller in Win10. If you are interested, follow the editor and take a look below! Win10 found the ATA controller technology

OPPO Find X7 is a masterpiece! Capture your every moment with images OPPO Find X7 is a masterpiece! Capture your every moment with images Aug 07, 2024 pm 07:19 PM

In this fast-paced era, OPPO Find X7 can use its imaging power to let us savor every beautiful moment in life. Whether it's magnificent mountains, rivers, lakes, or seas, warm family gatherings, or encounters and surprises on the street, it can help you record them with "unparalleled" picture quality. From the outside, the camera Deco design of Find It looks very recognizable and has a high-end feel. The inside is also unique, starting with the basic hardware configuration. FindX7 maintains the previous

Bash program to find A raised to the power B? Bash program to find A raised to the power B? Aug 30, 2023 pm 09:01 PM

Here we will see how to get the number A raised to the power B using a bash script. The logic is simple. We have to use the "**" operator or the power operator to do this. Let us see the following program to understand this concept clearly. Example#!/bin/bash#GNUbashScripta=5b=6echo "$(($a**$b))" output 15625

OPPO Find X8 Ultra core configuration exposed! Snapdragon 8 Gen4+ Extra Large Battery OPPO Find X8 Ultra core configuration exposed! Snapdragon 8 Gen4+ Extra Large Battery Aug 22, 2024 pm 06:54 PM

On August 22, a digital blogger revealed some core configuration information of OPPO Find X8 Ultra. According to the exposed content, this high-end model will be equipped with Qualcomm’s latest Snapdragon 8Gen4 mobile platform, equipped with a 6000mAh ultra-large capacity battery, and supports 100W wired fast charging and 50W wireless fast charging functions. Appearance design There is currently no specific design information about OPPO Find X8 Ultra. But the real picture of the standard version of OPPO Find X8 has been exposed on the Internet. Appearance of FindX8 Judging from the exposed photos, the rear camera module of OPPO FindX8 adopts a square design with a certain degree of curvature at the four corners, giving a more rounded feeling. In addition, the machine adopts a direct

What are the string search and replace techniques in Python? What are the string search and replace techniques in Python? Oct 20, 2023 am 11:42 AM

What are the string search and replace techniques in Python? (Specific code example) In Python, strings are a common data type, and we often encounter string search and replace operations in daily programming. This article will introduce some common string search and replacement techniques, accompanied by specific code examples. To find a specific substring in a string, you can use the find() method or index() method of the string. The find() method returns the index of the first occurrence of the substring in the string.

Where can I find the copied stuff? Where can I find the copied stuff? Feb 09, 2024 pm 10:18 PM

When using a computer, we can use shortcut keys to copy content. Some users have been using it for a long time and are curious about where to find the copied things. Let’s take a look at the method of pasting copied things brought by the editor. Where can you find the answer to what you copied: [Start Icon]-[Settings]-[System]-[Clipboard]-[Turn on Clipboard History]-[Hold Windows+V to view]. Specific steps: First, turn on the computer, find the [Start icon] in the lower left corner and click on it. Then a dialog box will pop up, click the [Settings] option. 2. Then in the settings page, you can see functions such as system, personalization, games, updates, and security. Here we click [System] Settings; 3. Then come to the system settings page

C program to find the largest prime factor of a number C program to find the largest prime factor of a number Aug 27, 2023 am 10:09 AM

PrimeFactor−Innumbertheory,theprimefactorsofapositiveintegeraretheprimenumbersthatdividethatintegerexactly.Theprocessoffindingthesenumbersiscalledintegerfactorization,orprimefactorization.Example−Primefactorsof288are:288=2x2x2x2x2

See all articles