ZOJ2376 POJ1852 Ants,贪心
来源:互联网 发布:扣字软件下载 编辑:程序博客网 时间:2024/05/17 10:38
所有蚂蚁碰头后互换方向,等价于碰头后对穿,交换身份。不知归到哪一类,就当做贪心吧
/******************************************************************************* # Author : Neo Fung # Email : neosfung@gmail.com # Last modified: 2011-12-23 18:12 # Filename: ZOJ2376 POJ1852 Ants.cpp # Description : ******************************************************************************/// #include "stdafx.h"// #define DEBUG#include <fstream>#include <stdio.h>#include <iostream>#include <string.h>#include <string>#include <memory.h>#include <limits.h>#include <algorithm>#include <math.h>#include <numeric>#include <functional>#include <ctype.h>using namespace std;int main(void){#ifdef DEBUG freopen("C:/Users/neo/Desktop/stdin.txt","r",stdin); freopen("C:/Users/neo/Desktop/stdout.txt","w",stdout); #endif int ncases,n;int len,maxpos,minpos;int pos;scanf("%d",&ncases);while(ncases--){maxpos=INT_MIN;minpos = INT_MIN;scanf("%d%d",&len,&n);for(int i=0;i<n;++i){scanf("%d",&pos);maxpos = max(maxpos,max(pos,len-pos));minpos = max(minpos,min(pos,len-pos));}printf("%d %d\n",minpos,maxpos);} return 0;}
- ZOJ2376 POJ1852 Ants,贪心
- POJ1852(Ants)
- poj1852 Ants
- poj1852 Ants
- POJ1852 Ants
- POJ1852 Ants
- POJ1852-Ants
- poj1852(Ants)
- POJ1852 Ants
- POj1852--Ants
- POJ1852 Ants
- 【poj1852】Ants
- poj1852 Ants
- POJ1852 Ants
- POJ1852 Ants
- POJ1852-Ants
- poj1852 Ants
- poj1852 Ants
- Windows7IIS安装配置完整版
- RHEL5.4安装pvfs-2.8.2(单节点)
- Redhat5.4安装pvfs-2.8.2全过程(集群)
- ARM11——点亮LED灯
- 利用字符串调用方法和属性
- ZOJ2376 POJ1852 Ants,贪心
- 如何读取xaml并显示在Canvas上
- ZOJ2511 HDU1031 Design T-Shirt, 贪心
- [转]单例模式——C++实现自动释放单例类的实例
- vim代码自动补全函数提示设置
- Linux----9----文件系统深入探讨
- HDU2846 Repository, Trie树
- CSDN被黑了?
- 一款免费音频编辑软件推荐Power Sound Editor Free