【题目链接】

 

  http://www.lydsy.com/JudgeOnline/problem.php?id=1432

 

【思路】

 

  找(cha)规(ti)律(jie)

  分析戳这儿 click here  

 

【代码】

 1 #include<cstdio>
 2 #include<iostream>
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     int n,k;
 8     scanf("%d%d",&n,&k);
 9     k=min(k,n-k+1);
10     printf("%d",n==1?1:2*k);
11     return 0;
12 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-11-22
  • 2021-09-17
  • 2022-01-13
  • 2021-07-30
猜你喜欢
  • 2021-11-06
  • 2021-10-01
  • 2021-07-14
  • 2021-05-24
  • 2022-02-09
  • 2021-04-27
相关资源
相似解决方案