hdu5523Game
来源:互联网 发布:如何提高精气神 知乎 编辑:程序博客网 时间:2024/06/14 16:16
http://acm.hdu.edu.cn/showproblem.php?pid=5523
情况比较多,要考虑周全,注意n=1时和s,t相邻时
#include <iostream>#include <cmath>using namespace std;int main(){ int s,t,n; while(cin>>n>>s>>t) { if(n==1) cout<<0<<endl; else { if(s==t) cout<<-1<<endl; else if((s==1&&t==n)||(s==n&&t==1)) cout<<0<<endl; else if((s==1||s==n)||fabs(s-t)==1) cout<<1<<endl; else cout<<2<<endl; } } return 0;}
0 0
- hdu5523Game
- bestcoder#61hdu5523Game
- java设计模式-桥接模式
- poj 1190 生日蛋糕(深搜+剪枝技巧)
- 【Java学习-J.160525.0.18】JNDI数据库连接池创建步骤
- 第13周阅读程序(1)虚函数
- 【Halcon】Blob分析的形态学算子应用(count_pellets.hdev)
- hdu5523Game
- containsKey
- kafka 数据删除策略
- js 获取文本框中光标所在字符串索引位置
- GIT - 基本概念(对象,索引,提交)
- 【CodeForces】#621A - Wet Shark and Odd and Even(水)
- Spring定时任务之Quartz
- 如何将Qt窗口的内容转化为图片?
- MIPS多周期CPU设计之使用时钟上升沿触发PC模块的实现方案