链接:
http://codeforces.com/problemset/problem/570/B
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87813#problem/I
代码:
#include<stdio.h> #include<string.h> #define N 1100 int main() { int n, m; while(scanf("%d%d", &n, &m)!=EOF) { if(n==1) ///只有1,他只能输了 { printf("1\n"); continue; } if(m>n/2) printf("%d\n", m-1); else printf("%d\n", m+1); } return 0; }
勿忘初心