【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

肯定是放在m-1或者m+1的。
(m-1是左边的点都离a最近,而m+1则是右边的点都离他最近。
看看哪个更好就行

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std; ll n,m; int main()
{
ios::sync_with_stdio(0),cin.tie(0);
#ifdef LOCAL_DEFINE
freopen("rush.txt","r",stdin);
#endif // LOCAL_DEFINE
cin >> n >> m;
if (m==1){
return cout<<min(n,1LL*2)<<endl,0;
}
if (m==n){
return cout<<max(1LL,n-1)<<endl,0;
}
int x = m-1,y = n-(m+1)+1;
if (x>=y){
cout <<m-1<<endl;
}else{
cout <<m+1<<endl;
}
return 0;
}

最新文章

  1. sphinx全文检索 安装配置和使用
  2. bzoj3437 小P的牧场
  3. the serializable class XXX does not declare a static final seriaVersionUID...的问题
  4. Unit4中的Annotation
  5. [大牛翻译系列]Hadoop(3)MapReduce 连接:半连接(Semi-join)
  6. union与struct以及大小端
  7. SKPhysicsBody类
  8. app耗电优化之四 使用AlarmManager对任务进行合理安排
  9. HTML的用法
  10. win10怎么安装JDK8,配置JDK8的环境变量
  11. Aho-Corasick算法实现(简单关键字过滤)
  12. 混合表单文件上传到数据库(基于TOMCAT)
  13. BootStrap Table将时间戳更改为日期格式
  14. mysql-5.7.12-winx64 安装
  15. lambda取两字符串的交集
  16. C++ 内存分配(new,operator new)详解
  17. MySQL Bugs: #34354: Feature request: EXPLAIN ALTER TABLE https://bugs.mysql.com/bug.php?id=34354
  18. marioTcp
  19. HTML基础-常用标签及图片
  20. PAT 甲级 1021 Deepest Root (并查集,树的遍历)

热门文章

  1. mysql-安全管理
  2. CSS透明度设置支持IE,Chrome,Firefox浏览器
  3. Android新手入门2016(14)--FragmentTabHost实现选项卡和菜单
  4. 37.创建自定义的指令的限制使用 通过restrict 设置
  5. Bayes++ Library入门学习之熟悉class-Importance_resampler
  6. codeforces 540 C Ice Cave【BFS】
  7. 十五 Canny边缘检测算法
  8. eBay起诉指控亚马逊利用非法手段挖走其卖家
  9. Python实现快排
  10. 08-for循环