poj-1852
2014-10-24 00:53
218 查看
转换思想 两只蚂蚁碰头反转时 相当于直接从对方身上走过去 直接前进
#include "stdio.h" #include "string.h" #include "math.h" #include "stdlib.h" #include <iostream> #include <algorithm> #include <stdlib.h> #include <queue> using namespace std; int t; int main() { cin>>t; while (t--) { int n,m,tt; cin>>n>>tt; int p; int an1=-1000000,an2=-1000000; for (int i=1;i<=tt;i++) { cin>>m; an1=max( an1,min( (n-m) ,(n-(n-m)) ) ); an2=max( an2,max( (n-m) ,(n-(n-m)) ) ); } cout<<an1<<" "<<an2<<endl; } return 0; }
相关文章推荐
- POJ 1852:Ants【规律】
- POJ 1852 Ants
- POJ -1852 Ants(白书1.6.2)
- POJ1852 Ant
- POJ1852-Ants
- POJ 1852 Ants
- poj 1852 隐形的蚂蚁---涵韶张
- POJ 1852 Ants
- poj 1852 Ants 发现问题,解决问题
- POJ 1852 Ants
- poj 1852 Ants
- POJ 1852 Ants
- Ants acmclub.com 10913 // poj 1852
- poj 1852 Ants
- 《挑战程序设计江赛》P18 题目:Ants POJ 1852 需要想象力的模拟
- poj 1852 ants
- POJ - 1852 Ants
- [ACM] POJ 1852 Ants
- poj1852——Ants(模拟)
- poj 1852