A. Divisibility
Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.
Input
The only line contains three space-separated integers k, a and b (1 ≤ k ≤ 1018; - 1018 ≤ a ≤ b ≤ 1018).
Output
Print the required number.
Sample test(s)
Input
1 1 10
Output
10
Input
2 -4 4
Output
5
1 #include<cstdio> 2 #include<cmath> 3 #include<cstdlib> 4 using namespace std; 5 typedef long long ll; 6 int main() 7 { 8 ll a,b,k,ans=0; 9 scanf("%I64d%I64d%I64d",&k,&a,&b); 10 if(a>=0) 11 ans=b/k-a/k+(a%k==0); 12 else if(b<=0) 13 ans=abs(a)/k-abs(b)/k+(abs(b)%k==0); 14 else 15 ans=1+b/k-a/k; 16 printf("%I64d",ans); 17 return 0; 18 }