hdu 5166(水题)
Missing number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1020 Accepted Submission(s): 518
is a permutation without two numbers in it, and now you know what
numbers the permutation has. Please find the two numbers it lose.
For each test case , the first line contains a integers n , which means the number of numbers the permutation has. In following a line , there are n distinct postive integers.(1≤n≤1,000)
3
3 4 5
1
1
2 3
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
bool Hash[];
int main()
{
int tcase;
scanf("%d",&tcase);
while(tcase--)
{
int n;
scanf("%d",&n);
memset(Hash,,sizeof(Hash));
int MIN = ,MAX = ;
for(int i=;i<=n;i++){
int v;
scanf("%d",&v);
Hash[v] = true;
MIN = min(v,MIN);
MAX = max(v,MAX);
}
int cnt = ;
int res[];
for(int v=;;v++){
if(!Hash[v]){
res[cnt] = v;
cnt++;
}
if(cnt==) break;
}
printf("%d %d\n",res[],res[]);
}
return ;
}
hdu 5166(水题)的更多相关文章
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
- HDU排序水题
1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...
- hdu 2710 水题
题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...
- Dijkstra算法---HDU 2544 水题(模板)
/* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...
- hdu 5162(水题)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...
- hdu 3357 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...
- hdu 5038 水题 可是题意坑
http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数 这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心 If not all ...
随机推荐
- spark发现新词
package com.icklick.spark.wordSegment import org.apache.log4j.{ Level, Logger } import org.apache.sp ...
- VSX-2 搭建项目
由于是公司的项目,也不可能直接拿过来写博客,所以准备搭建一个自己的VSX项目. 项目需求这里就不写了,大体可参考曾经的一篇文章,这个VSX项目就是用来简化插件式开发. 本文开始正式记录做这个VSX项目 ...
- 《1024伐木累》-BUG的通用解决办法
本周月侠出场,一番侠骨柔情,或许你会为丽姐担忧,或许你也很想知道,发现了一个不该发现的秘密,月侠的未来究竟会怎样,但是一切都只是一个开头,伴随故事成长,伴随故事了解时事,尤其是IT圈子里的事儿,或许真 ...
- 【Lowest Common Ancestor of a Binary Tree】cpp
题目: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. Accor ...
- 四 Android Capabilities讲解
本文转自:http://www.cnblogs.com/sundalian/p/5629429.html Android Capabilities讲解 1.Capabilities介绍 可以看下之 ...
- CentOS6.5下搭建LAMP环境(源码编译方式)
CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL) 学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP ,WAMP,MAMP等.这里我介 ...
- 转:sift算法详解
转自:http://blog.csdn.net/pi9nc/article/details/23302075 对于初学者,从David G.Lowe的论文到实现,有许多鸿沟,本文帮你跨越. 1.SIF ...
- C++寒假学习计划
课程 中国大学mooc西北工业大学c++程序设计 理由 本课程有48节,章节分类清晰,由许多小知识块组成,条例清晰便于学习,由基础开始,由浅入深,适合我这种小白. 计划 从2.8号至2.28除去2.1 ...
- BETA(1)
目录 组员情况 组员1(组长):胡绪佩 组员3:庄卉 组员4:家灿 组员5:凯琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示组内最新成果 团 ...
- js文字跳动效果
/*! * chaffle v1.0.0 * * Licensed under MIT * Copyright 2013-2014 blivesta * http://blivesta.com */ ...