标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5301
1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <algorithm> 5 using namespace std; 6 int n,m,x,y,s,l; 7 int main() 8 { 9 while(~scanf("%d%d%d%d",&n,&m,&x,&y)){ 10 if(m > n){ 11 s = max(n-x,x-1); 12 s = min(s,min(m-y+1,y)); 13 } 14 else{ 15 s = max(m-y,y-1); 16 s = min(s,min(n-x+1,x)); 17 } 18 l = min((m+1)/2,(n+1)/2); 19 s = max(s,l); 20 if(m == n && m % 2 == 1 && x == y && x == (n+1)/2) 21 s -= 1; 22 printf("%d\n",s); 23 } 24 return 0; 25 }
标签:
原文地址:http://www.cnblogs.com/blueprintf/p/4703552.html