import java.util.Scanner;
public class Main {
public static void main(String []args){
Scanner input=new Scanner(System.in);
int w=input.nextInt();
int m=input.nextInt();
int n=input.nextInt();
int width=0,min=0;
if(m>=n){
m=m;
}else {
min=m;
m=n;
n=min;
}
int t=0,g=0,tm,gn;
t=m/w;
g=n/w;
tm=m%w;
gn=n%w;
if((t%2==0)){
if(tm==0){
t=t-1;
}else{
tm=tm-1;
}
}else{
if(tm==0){
t=t-1;
tm=w-1;
}else {
tm=w-tm;
}
}
if(g%2==0){
if(gn==0){
g=g-1;
}else{
gn=gn-1;
}
}else{
if(gn==0){
g=g-1;
gn=w-1;
}else {
gn=w-gn;
}
}
width=t-g+Math.abs(tm-gn);
System.out.println(width);
}
}
蓝桥杯:1219移动距离(java)
最新推荐文章于 2024-11-16 12:43:59 发布