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 ...
随机推荐
- log4j:WARN Please initialize the log4j system properly. 异常解决
log4j:WARN Please initialize the log4j system properly. 这个异常很少遇到,咋一看,原来是没有配置logger4j的配置文件 问题解决方法: 传统 ...
- laravel oauth2.0 文件上传报错
报错信息: "message": "Invalid stream or file provided for UploadedFile", " ...
- 模拟ssh的远程网络传输
粘包产生的原因分析: 第一点:客户端向服务端发起命令请求,服务端接受命令请求,并返回对应的信息,如果信息过大,客户端一次接受不了,那么下一次请求依然返回 上一个命令的内容,就出现了粘包的情况. 第二点 ...
- 【学习笔记】深入理解js原型和闭包(10)——this
接着上一节讲的话,应该轮到“执行上下文栈”了,但是这里不得不插入一节,把this说一下.因为this很重要,js的面试题如果不出几个与this有关的,那出题者都不合格. 其实,this的取值,分四种情 ...
- 在服务端C#如何利用NPOI构建Excel模板
目前本人接触过两种模板导出的方式:(1)C#利用NPOI接口制作Excel模板,在服务端用数据渲染模板(2)在前端利用前人搭建好的框架,利用office编写xml制作模板,在客户端进行数据的渲染,导出 ...
- Apache CXF 框架结构和基本原理
CXF旨在为服务创建必要的基础设施,它的整体架构主要由以下几个部分组成: 1.Bus 它是C X F架构的主干,为共享资源提供了一个可配置的场所,作用非常类似于S p r i n g的Applicat ...
- 【HEVC简介】SAO-Sample Adaptive Offset, 样本自适应偏移量
paper: Sample Adaptive Offset for HEVC <HEVC标准介绍.HEVC帧间预测论文笔记>系列博客,目录见:http://www.cnblogs.com/ ...
- javaee 第四周作业
分析hello.java.下载链接:https://github.com/javaee/tutorial-examples/tree/master/web/jsf/hello1 /** * Copyr ...
- Django 路由 —— Djangon如何处理一个请求
Django URL路由概述 一个干净优雅的URL方案是高质量Web应用程序中的一个重要细则Django可以让你设计URL,无论你想要什么,没有框剪限制要为应用程序设计URL,您可以非正式地创建一个名 ...
- C-基础:冒泡排序
#include <fstream> #include <iostream.h> //--------------------------------------------- ...