CodeForces 597A Divisibility
1 second
256 megabytes
standard input
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.
The only line contains three space-separated integers k, a and b (1 ≤ k ≤ 1018; - 1018 ≤ a ≤ b ≤ 1018).
Print the required number.
1 1 10
10
2 -4 4
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相关推荐
- 【CodeForces 597A Divisibility】
Divisibility Find the number of k-divisible numbers on the segment [a, b]. In other words you need t ...
- CodeForces 597A Divisibility
水题. #include<iostream> #include<cstring> #include<cmath> #include<queue> #in ...
- CF 597A Divisibility
Divisibility Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Descr ...
- CodeForces 550C Divisibility by Eight(暴力)
http://http://codeforces.com/problemset/problem/550/C 题意: 给出一串数字,在原先的顺序基础上适当的删除一些数使得最终的结果能被8整除 解题思路: ...
- Codeforces 988E. Divisibility by 25
解题思路: 只有尾数为25,50,75,00的数才可能是25的倍数. 对字符串做4次处理,以25为例. a. 将字符串中的最后一个5移到最后一位.计算交换次数.(如果没有找到5,则不可能凑出25,考虑 ...
- CodeForces 597A
Description Find the number of k-divisible numbers on the segment [a, b]. In other words you need to ...
- CF597 (Div. 2)题解
A.乱搞gcd B.模拟题 C. 原始串中'w'字符会被替换成 uu 'm'字符会被替换成nn, 给你一个字符串,问你他原串有多少种可能 nnn -> nnn nm mn 3种 nnnn -&g ...
- 比尔·盖茨离婚内幕被曝光:长期出轨微软女下属 ;传记作者:他不是“技术宅”,好色在业内是公开的秘密!...
点击"开发者技术前线",选择"星标" 让一部分开发者看到未来 图片来源网络 来源:中国经营报(ID:chinabusinessjournal) ▎比尔盖茨 ...
- Codeforces Divisibility【水题】
A. Divisibility time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
最新文章
- 【转】Android source build/envsetup.sh学习笔记
- C#之windows桌面软件第二课:向单片机发信息的串口工具
- (Spring)声明式事务
- 工作中的小技巧(一)
- mysql 多数据库实例_Mysql多实例安装
- hdu4609 3-idiots
- Window下更新python pip源
- Visual Studio 2008 C++添加 链接库
- html5新增graph,Qunee for HTML5
- 中国开源产品如何走向世界?
- 60个有用CSS代码片段
- datatable 参数详细说明
- html5 webStorage:localStorage sessionStorage
- Button switch..case 语句监听按钮点击的方法。。下面这方法好。
- Asp.net实用技巧
- PHP exec() has been disabled for security reasons
- #!/bin/sh与#!/bin/bash有区别
- CodeProject上的两个简单绘图程序
- 深度linux投影教程,在深度Deepin系统使用XMind 8的方法
- Tomcat启动缓慢 Creation of SecureRandom instance for ... 花费时间过长的解决方法
热门文章
- 谷歌前量子部门“单飞”,正式成立量子软件公司Sandbox AQ
- 选择哪种护眼灯对眼睛好?盘点五款护眼台灯
- 如何把电脑的文件同步到云盘
- waf怎么读_技术分享:杂谈如何绕过WAF(Web应用防火墙)
- 计算机组成原理习题——日常记录
- [BMIm]BF4离子液体修饰的铜纳米粒子直径小于10nm
- Use Configs
- Support for password authentication was removed on August 13, 2021. Please use a personal access tok
- Redis使用总结(1):基础使用
- SD-NOIP2016游记