BZOJ1432: [ZJOI2009]Function

规律题,这规律无力吐槽了…

 1 /**************************************************************
 2     Problem: 1432
 3     User: zhuohan123
 4     Language: C++
 5     Result: Accepted
 6     Time:0 ms
 7     Memory:804 kb
 8 ****************************************************************/
 9  
10 #include <cstdio>
11 using namespace std;
12 inline int imin(int a,int b){return a<b?a:b;}
13 int main(int argc, char *argv[])
14 {
15     int n,k;scanf("%d%d",&n,&k);
16     printf("%d\n",n==1?1:2*imin(k,n-k+1));
17     return 0;
18 }

 

posted @ 2013-08-07 23:36  zhuohan123  阅读(628)  评论(0编辑  收藏  举报