poj 1825 Ants 水题
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 10722 | Accepted: 4752 |
Description
Input
Output
Sample Input
2
10 3
2 6 7
214 7
11 12 7 13 176 23 191
Sample Output
4 8
38 207
给你一堆蚂蚁,问全部蚂蚁掉下去的最少时间和最大时间
扫一遍就好
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 1000001
#define eps 1e-9
const int inf=0x7fffffff; //无限大
int x[maxn];
int main()
{
int t;
cin>>t;
while(t--)
{
int l,n;
scanf("%d%d",&l,&n);
int min_num=inf;
int max_num=;
int min_ans=;
int max_ans=;
for(int i=;i<n;i++)
{
scanf("%d",&x[i]);
min_num=min(x[i],l-x[i]);
//cout<<min_num<<endl;
min_ans=max(min_num,min_ans);
max_num=max(max_num,max(x[i],l-x[i]));
}
cout<<min_ans<<" "<<max_num<<endl;
}
return ;
}
poj 1825 Ants 水题的更多相关文章
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- poj 3264 RMQ 水题
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...
- Poj 1552 Doubles(水题)
一.Description As part of an arithmetic competency program, your students will be given randomly gene ...
- 最小费用最大流模板 poj 2159 模板水题
Going Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15944 Accepted: 8167 Descr ...
- POJ 1837 Balance 水题, DP 难度:0
题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物 ...
- POJ - 3090 gcd水题
大概题意就是求\(1 \le i,j \le n\)的\(gcd(i,j) = 1\)的个数+2(对于0的特判) 正解应该是欧拉函数或者高逼格的莫比乌斯反演 但数据实在太水直接打表算了 /*H E A ...
- POJ 1654 Area(水题)
题目链接 卡了一下精度和内存. #include <cstdio> #include <cstring> #include <string> #include &l ...
- POJ 3080 (字符串水题) Blue Jeans
题意: 找出这些串中最长的公共子串(长度≥3),如果长度相同输出字典序最小的那个. 分析: 用库函数strstr直接查找就好了,用KMP反而是杀鸡用牛刀. #include <cstdio> ...
- POJ 2365 Rope(水题)
[题意简述]:给出我们钉子个数与半径,让我们求出缠绕在钉子上的绳子有多长. [分析]:从题目中我们能够看出,绳子长度的和等于每两个钉子的距离的和加上接触在钉子上的绳子的长度,不难发现这部分长度事实上就 ...
随机推荐
- weblogic更改端口
两种方式: 1.访问console控制台页面,进入“环境\服务器\需要修改端口的服务器如AdminServer”,修改监听端口,保存并激活更改即可: 2.修改配置文件,进入weblogic的域目录,如 ...
- Java数据类型以及变量的定义
1130136248 Java的基本数据类型 变量就是申请内存来存储值.也就是说,当创建变量的时候,需要在内存中申请空间. 内存管理系统根据变量的类型为变量分配存储空间,分配的空间只能用来储存该类 ...
- laravel 中provider的理解和使用
https://segmentfault.com/q/1010000004640866
- 利用vw+rem实现移动web适配布局
基本概念 1.单位 Px(CSS pixels) 像素 (px) 是一种绝对单位(absolute units), 因为无论其他相关的设置怎么变化,像素指定的值是不会变化的 其实是相对于某个设备而言的 ...
- [USACO16OPEN]262144
传送门啦 其实大家可以先看一下这个题 [USACO16OPEN]248 分析: 数据范围很奇特:n特别,a[i]特别——如果O(N^3)能接受就直接区间DP水过了,但是不行,于是考虑设计一个状态囊括a ...
- CSS — 贝塞尔曲线(cubic-bezier)
cubic-bezier 又称三次贝塞尔,主要是为 animation 生成速度曲线的函数,规定是 cubic-bezier(<x1>, <y1>, <x2>, & ...
- 规范命名CSS
作者:词晖链接:https://www.zhihu.com/question/19586885/answer/48933504来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...
- 对于ElasticSearch与Hadoop是如何互相调用的?
1.在HDFS中,数据是以文件形式保存的,比如JSON: https://blog.csdn.net/napoay/article/details/68945483 2.python读写HDFS,一般 ...
- android拾遗——Android 动画学习笔记
3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中又引入了一个新的动画系统:property animation,这三 ...
- day5模块学习--yaml文件处理
yaml文件处理(http://pyyaml.org/wiki/PyYAMLDocumentation) 摘要: 本文讲的是yaml在python上的使用教程详解, YAML是一种容易人类阅读 ...