POJ 1852 Ants
来源:互联网 发布:域名查询 美橙互联 编辑:程序博客网 时间:2024/05/18 02:42
简单水题,练手
#include <stdio.h>#defineMIN(a,b)(a<b ? a:b)#defineMAX(a,b)(a>b ? a:b)int ant[1000005];void solve(int L, int n){int i, tmp;int max_early, max_late;max_early = max_late = -1;for(i=1; i<=n; i++){tmp = MIN(ant[i], L-ant[i]);max_early = MAX(max_early, tmp);tmp = MAX(ant[i], L-ant[i]);max_late = MAX(max_late, tmp);}printf("%d %d\n", max_early, max_late);}int main(void){int L, n, case_n, i;//freopen("input.dat", "r", stdin);scanf("%d", &case_n);while(case_n--){scanf("%d %d", &L, &n);for(i=1; i<=n; i++)scanf("%d", ant+i);solve(L, n);}return 0;}
0 0
- poj 1852 Ants
- POJ 1852 Ants
- poj 1852Ants
- POJ 1852 Ants 蚂蚁
- POJ 1852 Ants
- POJ 1852 Ants
- POJ-1852-Ants
- POJ 1852 Ants
- [ACM] POJ 1852 Ants
- POJ 1852 Ants
- POJ 1852 Ants 模拟
- POJ 1852 ANTS
- poj 1852 ants
- POJ 1852 Ants
- POJ 1852 Ants
- POJ 1852 Ants
- POJ 1852 Ants
- Ants(POJ 1852)
- servlet后台如何接收对象参数
- HDU1969 Pie(二分搜索)
- presentviewcontroller 动画
- arm启动脚本里面经常出现1b
- leveldb的makefile剖析
- POJ 1852 Ants
- Mysql limit 分页机制和优化实例
- 5.2-1
- C++面试宝典(整理版)2
- linux gdb调试笔记
- HDU ACM 1084 What Is Your Grade?
- 安卓应用商店遭遇的创新窘境
- java中多态的小例子
- [堆] HDU4006 The kth great number