题目:
1 #include2 using namespace std; 3 typedef long long ll; 4 const int INF = 0x3f3f3f3f; 5 const int M = 1178706+3; 6 7 int n, m; 8 int main() { 9 while( ~scanf("%d %d", &n, &m ) ) {10 if( n == 1 ) {11 printf("1\n");12 continue;13 }14 if( m > n/2 )15 printf("%d\n", m-1 );16 else17 printf("%d\n", m+1 );18 } 19 return 0;20 }