#include<stdio.h>
#include<string.h>
#include<algorithm>
#define LL __int64
using namespace std;
int main()
{
LL k,x,y;
scanf("%I64d%I64d%I64d",&k,&x,&y);
if(x>0)
{
if(x%k==0)
{
LL ans=y/k-x/k+1;
printf("%I64d\n",ans);
}
else
{
LL ans=y/k-x/k;
printf("%I64d\n",ans);
}
}
else if(x==0)
{
if(y!=0)
{
LL ans=y/k-x/k+1;
printf("%I64d\n",ans);
}
else
{
printf("1\n");
}
}
else
{
if(y<0)
{
if((y*-1)%k==0)
{
LL ans=(x*-1)/k-(y*-1)/k+1;
printf("%I64d\n",ans);
}
else
{
LL ans=(x*-1)/k-(y*-1)/k;
printf("%I64d\n",ans);
}
}
if(y==0)
{
LL ans=(x*-1)/k-(y*-1)/k+1;
printf("%I64d\n",ans);
}
if(y>0)
{
LL ans=(x*-1)/k+y/k+1;
printf("%I64d\n",ans);
}
}
return 0;
}
CodeForces 597A-Divisibility【数学】
最新推荐文章于 2020-01-29 23:14:26 发布