ZOJ3860-Find the Spy
Find the Spy
Time Limit: 2 Seconds Memory Limit: 65536 KB
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
很显然的一道签到题,学长们看第一句话然后看看样例就分分钟把代码敲好了,而我这种菜鸟虽然不相信题目这么简单但还是敲好了代码,测试过,学长看到32-bit integers以为要用long long,之前在FZU上已经吃过亏了,所以果断用I64d输出,第一遍
CE了,显示什么头文件的问题,改改还是CE,才发现交题要用c++,但又PE了,哎,,,换了种思路却wa了两遍,于是又回到第一种思路代码上,仔细看看题,原来它指定的是lld输出,醉了,,改了一交,过了。无言以对。。。
在ZOJ上测试发现每个oj的测评系统都有点不同,下次还是要细心一点;
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=100+10;
int a[N];
int main()
{
int t,n,i;//居然int也能过;
scanf("%d",&t);
while(t--)
{
memset(a,0,sizeof(a));
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);//搜了下代码,原来思路和标准代码一模一样;
if(a[0]==a[1])
printf("%d\n",a[n-1]);
else
printf("%d\n",a[0]);
}
return 0;
}
ZOJ3860-Find the Spy的更多相关文章
- UVA - 1025 A Spy in the Metro[DP DAG]
UVA - 1025 A Spy in the Metro Secret agent Maria was sent to Algorithms City to carry out an especia ...
- Manthan, Codefest 16 -C. Spy Syndrome 2
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 用PowerMock spy mock private方法
在实际的工作中,经常碰到只需要mock一个类的一部分方法,这时候可以用spy来实现. 被测类: public class EmployeeService { public boolean exist( ...
- Jasmine测试ng Promises - Provide and Spy
jasmine提供了很多些很实用的处理Promises的方法,首先我们来考虑下面的这个例子: angular.module("myApp.store").controller(&q ...
- UVa 1025 A Spy in the Metro(动态规划)
传送门 Description Secret agent Maria was sent to Algorithms City to carry out an especially dangerous ...
- UVA1025---A Spy in the Metro(DP)
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35913 Secret agent Maria was sent to Alg ...
- ZOJ 3860: - Find the Spy
3860 - Find the Spy Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu S ...
- 如何使用SPY++查找
自动化测试中,如果需要做UI automation的时候往往需要抓取object的工具.实际上这种工具有很多,认识的大牛使用SPY++,于是我也选择了这个.下面列出基本使用方法.有点像XACC spy ...
- SPY++的使用
百度百科Spy++ 使用的是VS2010.net自带的功能,可以从开始菜单中打开.
- 运用Real Spy Monitor监控网络
Real Spy Monitor是一个监测互联网和个人电脑,以保障其安全的软件.包括键盘敲击.网页站点.视窗开关.程序执行.屏幕扫描以及文件的出入等都是其监控的对象. 1.添加使用密码 在使用Real ...
随机推荐
- C8051特点
C8051与传统51的区别在于优先权交叉开关.系统时钟.SFR寄存器几个方面: 一 优先权交叉开关:传统的51外设功能是固定分配或者复用分配到指定引脚,而C8051则是通过优先权交叉开关设置,即要想分 ...
- 分区表,磁盘概念和parted的使用
分区表,磁盘概念和parted的使用 登录陌生系统首先要做的事: 个人认为,首先得知道Linux版本的什么:cat /etc/issue df:查看磁盘的分区和数据的分配情况,类型(NFS,ext4. ...
- JUnit的好搭档-Hamcrest
一.Hamcrest简介 Hamcrest是一个用于编写匹配器(matcher)对象的框架,允许以声明方式定义“匹配(match)”规则.它可以与JUnit框架配合使用,使断言可读更高,更加灵活(例如 ...
- PKU_campus_2018_A Wife
思路: 题目链接http://poj.openjudge.cn/practice/C18A/ 先说一个结论,每一天要么7要么0,由此提供一种状态压缩dp的解法. 实现: #include <bi ...
- this的试题
1.var x=12; function test(){ console.log(this.x) } test() //主体是window 2.var x=12; function test ...
- pip install python-igraph 报错,C core of igraph 没有安装。
(一)问题描述 Centos7 安装python-igraph时,pip install python-igraph 报错,C core of igraph 没有安装. failure: repoda ...
- hard fault 学习记录
使用 segger 的 hard fault 的源文件后,当调试时,发生硬件错误的时候,可以查看 HardFaultRegs 中的内容,并对比 segger_HardFaultHandler.c 中的 ...
- C++中:点运算符和箭头运算符的区别
点运算符用于获取对象成员: 箭头运算符用于获取指针指向的对象的成员: 例如: std::string s1 = "string"; std::string *p = &s1 ...
- Microsoft Windows Server 部署
Microsoft Windows Server 部署 多重引导 计算机可以被设置多重引导,即在一台计算机上安装多个操作系统..在安装多重引导的操作系统时,还要注意版本的类型,一般应先安装版本低的,再 ...
- git-忽略文件改动不进行提交
命令:git update-index --assume-unchanged 文件名 作用:忽略文件的改动,但是不加入.gitignore 文件中,这样可以达到仅在本地目录中忽略,不影响其他团队成员的 ...