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 }

 

posted @ 2015-08-14 15:34  TaoTaoCome  阅读(154)  评论(0编辑  收藏  举报