我是靠谱客的博主 单纯便当,这篇文章主要介绍A. Divisibility,现在分享给大家,希望可以做个参考。

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 xthat a ≤ x ≤ b and x is divisible by k.

Input

The only line contains three space-separated integers ka and b (1 ≤ k ≤ 1018; - 1018 ≤ a ≤ b ≤ 1018).

Output

Print the required number.

Sample test(s)
Input
复制代码
1
1 1 10
Output
复制代码
1
10
Input
复制代码
1
2 -4 4
Output
复制代码
1
5
AC:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<stdio.h> int main() { long long k,a,b; while(scanf("%lld%lld%lld",&k,&a,&b)!=EOF) { long long s=0; if(b<0) { a=-a;b=-b; long long t=a; a=b; b=t; } s=b/k-a/k; if(a%k==0||a<=0) s++; printf("%lldn",s); } return 0; }


最后

以上就是单纯便当最近收集整理的关于A. Divisibility的全部内容,更多相关A.内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部