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平方英里,以初始水岸线为 ...
随机推荐
- expect实现交互式脚本
#!/usr/bin/expect -f ##告诉解释器用expect来解释 set timeout 6 ##设置超时时间 ] ## 这个是传递给脚本的第一个参数,并把参数赋值给user ] ## 这 ...
- MySQL(Unix时间戳、日期)转换函数
unix_timestamp() mysql> select unix_timestamp(); +------------------+ | unix_timestamp() | +----- ...
- ClassLoader,Thread.currentThread().setContextClassLoader,tomcat的ClassLoader
实际上,在Java应用中所有程序都运行在线程里,如果在程序中没有手工设置过ClassLoader,对于一般的java类如下两种方法获得的ClassLoader通常都是同一个 this.getClass ...
- Swift游戏实战-跑酷熊猫 09 移除场景之外的平台
上一节,我们写出了一个疯狂产生平台的东西.所谓上帝欲使其灭亡,必先使其疯狂.所以太疯狂都不是什么好事,所以我们要采取一些措施,例如移除场景之外的平台.btw如果哪天你觉得自己的老板行为乖张,难以理喻. ...
- 体验Java的封装性
package com.cnblogs.java; //体验Java的封装性 /* * 如下的人类年龄赋值-300岁,显然很不合理,这种直接对类的属性赋值,有时候虽然不合理但却会编译通过. * 所以我 ...
- Fedora20 MATE Destop 环境下安装Sougoupinyin输入法+皮肤
卸载ibus # yum erase ibus* 选择性安装 fcitx # yum install fcitx fcitx-configtool $ ls -a $ vi .bashrc .bas ...
- 如何使用highmaps制作中国地图
如何使用highmaps制作中国地图 文章目录 Highmaps 所需文件 地图初始化代码 highmaps 渲染讲解 highmaps 中国各城市坐标的json文件 highmaps 线上DEMO ...
- BaseAction的一般写法
package com.mi.action; import java.util.Map; import javax.servlet.http.HttpServletRequest; import ja ...
- backend flow
在PD之后,netlist中会多出很多DCAP元件(去耦电容,减少IR-Drop)或者filter cell(保证芯片均匀度要求) 还有一些antenna cell也就是一些diode用来泻流,防止天 ...
- ASP.NET MVC5 新特性:Attribute路由使用详解 (转载)
1.什么是Attribute路由?怎么样启用Attribute路由? 微软在 ASP.NET MVC5 中引入了一种新型路由:Attribute路由,顾名思义,Attribute路由是通过Attrib ...