luogu P1007 独木桥
二次联通门 : luogu P1007 独木桥
/* luogu P1007 独木桥 模拟 */ #include <cstdio> inline int min (int a, int b) { return a < b ? a : b; } inline int max (int a, int b) { return a > b ? a : b; } void read (int &now) { register char word = getchar (); for (now = 0; word < '0' || word > '9'; word = getchar ()); for (; word >= '0' && word <= '9'; now = now * 10 + word - '0', word = getchar ()); } int main (int argc, char *argv[]) { int L, N; read (L); read (N); int x, y; if (!N) { printf ("0 0"); return 0; } int Max_Answer = -1, Min_Answer = -1; for (int i = 1; i <= N; i ++) { read (x); Max_Answer = max (Max_Answer, max (L - x + 1, x)); Min_Answer = max (Min_Answer, min (L - x + 1, x)); } printf ("%d %d", Min_Answer, Max_Answer); return 0; }
myj 吊打我Orz,xxy 捆起来打我Orz,myl 文化课上天Orz, lrh 姿势水平敲高Orz, hkd 特别胖Orz%%%,cys 智商感人Orz,syl zz专业Orz,我没有学上, 我们未来一片光明