码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 1852 - Ants

时间:2016-11-23 08:06:10      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:string   ems   while   nts   inf   ++   algo   ant   ring   

题意

思路

总结

竟然因为用cin cout超时???EXCUSE ME???

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 #include <cstring>
 5 using namespace std;
 6 const int INF = 0x3f3f3f3f;
 7 const int maxn = 1000005;
 8 int T, n, m;
 9 int s[maxn];
10 int main()
11 {
12     //freopen("in.txt", "r", stdin);
13     scanf("%d", &T);
14     while(T--) {
15         memset(s, 0, sizeof s);
16         scanf("%d %d", &n, &m);
17         int Min = 0, Max = 0;
18         for(int i = 0; i < m; i++) {
19             scanf("%d", &s[i]);
20             int k = min(s[i], n - s[i]);
21             Min = max(Min, k);
22             Max = max(Max, n - k);
23         }
24         printf("%d %d\n", Min, Max);
25     }
26 
27     return 0 ;
28 }

 

POJ 1852 - Ants

标签:string   ems   while   nts   inf   ++   algo   ant   ring   

原文地址:http://www.cnblogs.com/md-zz/p/6092219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!