ZOJ 3860: - Find the Spy
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld
& %llu
Description
Whoooa! There is a spy in Marjar University. All we know is that the spy has a special ID card. Please find him out!
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains a integer N (3 <= N <= 100), which describes that there are N students need to be checked.
The second line contains N integers indicating the ID card number of N students. All ID card numbers are 32-bit integers.
Output
For each test case, output the ID card number which is different from others.
Sample Input
3 10 1 1 1 1 1 1 1 1 6 1 3 9 9 8 5 90016 90016 90016 2009 90016
Sample Output
6 8 2009
题意:找出N个数中与其他数不同的一个……
#include <iostream> #include <cmath> #include <stdio.h> #include <string> #include <cstring> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <iomanip> #include <algorithm> #include <memory.h> using namespace std; int main() { int N; cin>>N; while(N--) { int n; int a=-1,b=-1; int a1=0,b1=0; cin>>n; for(int i=0;i<n;i++) { int k; cin>>k; if(a==k||a==-1)a=k,a1++; else b=k,b1++; } printf("%d\n",a1>b1?b:a); } return 0; }
ZOJ 3860: - Find the Spy的更多相关文章
- The 15th Zhejiang University Programming Contest
a ZOJ 3860 求和大家不一样的那个数,签到,map水之 #include<cstdio> #include<map> using namespace std; map ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- zoj 2081 BFS 延迟标记 读入问题
Mission Impossible Time Limit: 2 Seconds Memory Limit: 65536 KB ...
- ZOJ3860-Find the Spy
Find the Spy Time Limit: 2 Seconds Memory Limit: 65536 KB Whoooa! There is a spy in Marjar Univ ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1392 The Hardest Problem Ever
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <std ...
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
这道题目说白了是一道平面几何的数学问题,重在理解题目的意思: 题目说,弗雷德想买地盖房养老,但是土地每年会被密西西比河淹掉一部分,而且经调查是以半圆形的方式淹没的,每年淹没50平方英里,以初始水岸线为 ...
随机推荐
- windows远程控制ubuntu尝试--未成功
按照百度知道上的步骤一步一步操作,下载xrdp,一切很顺利. 直至出现了,如下的語言: connecting to sesman ip 尝试找到原因第一个原因 第二次的分析解释 至今还没找出原因
- 深入理解JAVA I/O系列六:Linux中的IO模型
IO模型 linux系统IO分为内核准备数据和将数据从内核拷贝到用户空间两个阶段. 这张图大致描述了数据从外部磁盘向运行中程序的内存中移动的过程. 用户空间.内核空间 现在操作系统都是采用虚拟存储器, ...
- 在Swift中整数以及浮点的格式化
1 整数的格式化 有的时候我们需要将整数输出为类似01,02,001,002这样的格式. 那么在swift中我们可以这样写 let i= let str = String(format:"% ...
- [原创]java WEB学习笔记55:Struts2学习之路---详解struts2 中 Action,如何访问web 资源,解耦方式(使用 ActionContext,实现 XxxAware 接口),耦合方式(通过ServletActionContext,通过实现 ServletRequestAware, ServletContextAware 等接口的方式)
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- Python和Ruby抓取网页时的中文乱码问题(在Eclipse和Apatana Studio下均是这种解决方法
Python抓取中文网页乱码 :Eclipse+pydev2.2+python2.7 :Apatana Studio3+ pydev2.2+python2.7 run时设置 run--&g ...
- .NET: C#: 获取当前路径
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.X ...
- 启动一个线程是用run()还是start()?
启动一个线程是用run()还是start()? 答:启动一个线程是调用start()方法,使线程所代表的虚拟处理机处于可运行状态,这意味着它可以由JVM调度并执行.这并不意味着线程就会立即运行.run ...
- 对while((pid = waitpid(-1, &stat, WNOHANG)) > 0)不懂的地方,现在懂了
while((pid = waitpid(-1, &stat, WNOHANG)) > 0) 需要写到信号处理函数中,假如有10个子进程 只要父进程能够收到最后一个信号,就能把前面丢失的 ...
- php获取文件后缀名格式
function get_extension($file) { substr(strrchr($file, '.'), 1); } 第2种方法: function get_extension($fil ...
- .NET 4.0 MemoryCache with SqlChangeMonitor
Summary There isn't a lot of documentation on the internet about how to use the SqlChangeMonitor wit ...