DivisibilityCrawling in process...

Crawling failed
Time Limit:1000MS    
Memory Limit:262144KB    
64bit IO Format:
%I64d & %I64u

Description

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 Input

Input
1 1 10
Output
10
Input
2 -4 4
Output
5

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
__int64 a,b,k;
while(scanf("%I64d%I64d%I64d",&k,&a,&b)!=EOF)
{
__int64 ans=0;
ans=b/k-a/k;
if(a==0&&b==0)
cout<<1<<endl;
else
{
if(a>=0&&b>=0&&a%k==0) ans++;
else if(a<=0&&b<=0&&b%k==0) ans++;
else if(a<=0&&b>=0) ans++;
printf("%I64d\n",ans);
}
}
return 0;
}

最新文章

  1. Mac常用终端命令
  2. MAC下搭建web开发环境
  3. asp.net读取xml方法
  4. windows 与Linux 互传文件
  5. css属性之vertical-align详解
  6. ABP官方文档翻译 5.1 Web API控制器
  7. css文字居中、图片居中、div居中解决方案
  8. 第二章 Idea搭建maven
  9. 高可用Redis(十三):Redis缓存的使用和设计
  10. Android绘制优化(一)绘制性能分析
  11. db2 OLAP函数使用
  12. Jmeter(二十八)Jmeter-Question之“HTTPS请求”
  13. 【Linux】CentOS7 安装,遇到的各种问题,并修复win7启动项
  14. Microsoft Dynamics CRM 常用JS语法(已转成vs2017语法提示)
  15. 安装ganglia过程中出现错误 perl(RRDp) is needed by rrdtool-1.2.30-1.el5.rf.x86_64
  16. [LeetCode] 58. Length of Last Word_Easy tag: String
  17. Luogu 3246 序列
  18. 如何在github上上传readme文件
  19. C#中的多线程 - 并行编程 z
  20. python科学计算整理

热门文章

  1. 从整体上理解进程创建、可执行文件的加载和进程执行进程切换,重点理解分析fork、execve和进程切换
  2. 服务器 获取用户 真实ip
  3. xilinx vivado 百度云分享 vivado2019.1 2018.3 2017.4
  4. Java基础——二分法
  5. Gym - 101670C Chessboard Dancing(CTU Open Contest 2017 找规律)
  6. ubuntu 下安装wine
  7. Python pygame库的应用
  8. atCoder Ants on a Circle(又是蚂蚁问题。。。)
  9. Java Arrays.sort相关用法与重载
  10. 这个贴子的内容值得好好学习--实例详解Django的 select_related 和 prefetch_related 函数对 QuerySet 查询的优化