Codeforces Round #316 (Div. 2B) 570B Simple Game 贪心
题目:Click here
1 #include <bits/stdc++.h> 2 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 else 17 printf("%d\n", m+1 ); 18 } 19 return 0; 20 }