poj1852
简单题
#include <cstdio> #include <algorithm> using namespace std; int l, n; void input() { int earliest, latest; scanf("%d%d", &l, &n); latest = 0; earliest = 0; for (int i = 0; i < n; i++) { int a; scanf("%d", &a); earliest = max(earliest, min(a, l - a)); latest = max(latest, max(a, l- a)); } printf("%d %d\n", earliest, latest); } int main() { int t; scanf("%d", &t); while (t--) { input(); } return 0; }