标签:
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 14610 | Accepted: 6363 |
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
Source
1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 5 int main() 6 { 7 int t; 8 scanf("%d", &t); 9 while(t--){ 10 int len, n; 11 scanf("%d%d", &len, &n); 12 int minT = 0, maxT = 0; 13 int pos; 14 while(n--){ 15 scanf("%d", &pos); 16 minT = max(minT, min(pos, len-pos)); 17 maxT = max(maxT, max(pos, len-pos)); 18 } 19 printf("%d %d\n", minT, maxT); 20 } 21 return 0; 22 }
标签:
原文地址:http://www.cnblogs.com/inmoonlight/p/5691077.html