Divisibility
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 thata ≤ 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.

Examples
input
1 1 10

output
10

input
2 -4 4

output

5

#include<stdio.h>
int main()
{long long a,b,k,ans;while(scanf("%lld%lld%lld",&k,&a,&b)!=EOF){if(a<=0&&b<=0){  long long c;c=-a;a=-b;b=c;}if(a<=0&&b>=0){a=-a;ans=b/k+a/k+1;}elseans=b/k-(a-1)/k;printf("%lld\n",ans);   }return 0;
}

CodeForces 597A Divisibility相关推荐

  1. 【CodeForces 597A Divisibility】

    Divisibility Find the number of k-divisible numbers on the segment [a, b]. In other words you need t ...

  2. CodeForces 597A Divisibility

    水题. #include<iostream> #include<cstring> #include<cmath> #include<queue> #in ...

  3. CF 597A Divisibility

    Divisibility Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Descr ...

  4. CodeForces 550C Divisibility by Eight(暴力)

    http://http://codeforces.com/problemset/problem/550/C 题意: 给出一串数字,在原先的顺序基础上适当的删除一些数使得最终的结果能被8整除 解题思路: ...

  5. Codeforces 988E. Divisibility by 25

    解题思路: 只有尾数为25,50,75,00的数才可能是25的倍数. 对字符串做4次处理,以25为例. a. 将字符串中的最后一个5移到最后一位.计算交换次数.(如果没有找到5,则不可能凑出25,考虑 ...

  6. CodeForces 597A

    Description Find the number of k-divisible numbers on the segment [a, b]. In other words you need to ...

  7. CF597 (Div. 2)题解

    A.乱搞gcd B.模拟题 C. 原始串中'w'字符会被替换成 uu 'm'字符会被替换成nn, 给你一个字符串,问你他原串有多少种可能 nnn -> nnn nm mn 3种 nnnn -&g ...

  8. 比尔·盖茨离婚内幕被曝光:长期出轨微软女下属 ;传记作者:他不是“技术宅”,好色在业内是公开的秘密!...

    点击"开发者技术前线",选择"星标" 让一部分开发者看到未来 图片来源网络    来源:中国经营报(ID:chinabusinessjournal) ▎比尔盖茨 ...

  9. Codeforces Divisibility【水题】

    A. Divisibility time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

最新文章

  1. 【转】Android source build/envsetup.sh学习笔记
  2. C#之windows桌面软件第二课:向单片机发信息的串口工具
  3. (Spring)声明式事务
  4. 工作中的小技巧(一)
  5. mysql 多数据库实例_Mysql多实例安装
  6. hdu4609 3-idiots
  7. Window下更新python pip源
  8. Visual Studio 2008 C++添加 链接库
  9. html5新增graph,Qunee for HTML5
  10. 中国开源产品如何走向世界?
  11. 60个有用CSS代码片段
  12. datatable 参数详细说明
  13. html5 webStorage:localStorage sessionStorage
  14. Button switch..case 语句监听按钮点击的方法。。下面这方法好。
  15. Asp.net实用技巧
  16. PHP exec() has been disabled for security reasons
  17. #!/bin/sh与#!/bin/bash有区别
  18. CodeProject上的两个简单绘图程序
  19. 深度linux投影教程,在深度Deepin系统使用XMind 8的方法
  20. Tomcat启动缓慢 Creation of SecureRandom instance for ... 花费时间过长的解决方法

热门文章

  1. 谷歌前量子部门“单飞”,正式成立量子软件公司Sandbox AQ
  2. 选择哪种护眼灯对眼睛好?盘点五款护眼台灯
  3. 如何把电脑的文件同步到云盘
  4. waf怎么读_技术分享:杂谈如何绕过WAF(Web应用防火墙)
  5. 计算机组成原理习题——日常记录
  6. [BMIm]BF4离子液体修饰的铜纳米粒子直径小于10nm
  7. Use Configs
  8. Support for password authentication was removed on August 13, 2021. Please use a personal access tok
  9. Redis使用总结(1):基础使用
  10. SD-NOIP2016游记