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;
}

Codeforces--597A--Divisibility(数学)的更多相关文章

  1. [math] Codeforces 597A Divisibility

    题目:http://codeforces.com/problemset/problem/597/A Divisibility time limit per test 1 second memory l ...

  2. CodeForces 597A Divisibility

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

  3. Codeforces Round #829 (Div. 2) D. Factorial Divisibility(数学)

    题目链接 题目大意: \(~~\)给定n个正整数和一个数k,问这n个数的阶乘之和能不能被k的阶乘整除 既:(a\(_{1}\)!+a\(_{2}\)!+a\(_{3}\)!+....+a\(_{n}\ ...

  4. Codeforces 550C —— Divisibility by Eight——————【枚举 || dp】

     Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  5. CodeForces 173A Rock-Paper-Scissors 数学

    Rock-Paper-Scissors 题目连接: http://codeforces.com/problemset/problem/173/A Description Nikephoros and ...

  6. codeforces 630J Divisibility

    J. Divisibility time limit per test 0.5 seconds memory limit per test 64 megabytes input standard in ...

  7. Success Rate CodeForces - 807C (数学+二分)

    You are an experienced Codeforces user. Today you found out that during your activity on Codeforces ...

  8. Codeforces 922F Divisibility 构造

    Divisibility 我们考虑删数字 首先我们可以发现有一类数很特殊就是大于 n / 2的素数, 因为这些素数的贡献只有1, 并且在n大的时候, 这些素数的个数不是很少, 我们可以最后用这些数去调 ...

  9. Codeforces 922F Divisibility (构造 + 数论)

    题目链接  Divisibility 题意 给定$n$和$k$,构造一个集合$\left\{1, 2, 3, ..., n \right\}$的子集,使得在这个集合中恰好有$k$对正整数$(x, y) ...

  10. Codeforces 622F 「数学数论」「数学规律」

    题意: 给定n和k,求 1 ≤ n ≤ 109, 0 ≤ k ≤ 106 思路: 题目中给的提示是对于给定的k我们可以求出一个最高次为k+1的关于n的通项公式. 根据拉格郎日插值法,我们可以通过k+2 ...

随机推荐

  1. 第一节:重写(new)、覆写(overwrite)、和重载(overload)

    一丶重写<NEW> 子类重写父类方法,方法里加new, eg: public new void CommonMethord1(string msg){} 子类继承父类中的普通方法,如果在子 ...

  2. UVALIVE6886 Golf Bot (FFT)

    题意:打高尔夫 给你n个距离表示你一次可以把球打远的距离 然后对于m个询问 问能否在两杆内把球打进洞 题解:平方一下就好 注意一下x0的系数为1表示打一杆 才发现数组应该开MAXN * 4 之前写的题 ...

  3. list查询棚舍面积的时候,所有棚舍面积的value都是一样的

    解决办法 将pickingid在查list之前set到对象中,通过id来匹配查询 具体代码: FarmHouse farmHouse=new FarmHouse(); farmHouse.setPic ...

  4. cc.Node—事件响应

    触摸事件1: 触摸事件类型: START, MOVED, ENDED(物体内), CANCEL(物体外);2: 监听触摸事件: node.on(类型, callback, target(回掉函数的th ...

  5. 洛谷——P3373 【模板】线段树 2&& B 数据结构

    P3373 [模板]线段树 2 题目描述 如题,已知一个数列,你需要进行下面三种操作: 1.将某区间每一个数乘上x 2.将某区间每一个数加上x 3.求出某区间每一个数的和 线段树维护区间乘法 1.如何 ...

  6. 关于C++中字符串输入get与getline的区别

    最近使用C++中自己老是忘记的一个点,get与getline的区别. 1.get与getline get和getline所属iostream类,作用是读取一整行,通过换行符确定读取结束,他们都可以读取 ...

  7. db2记录去重

    --查出二码,归档日期,借据号重复的数据的条数 select default_index_item_id,record_date,index_yxdk_dkjjh,min(sys_org_id),ma ...

  8. Java 十二周总结

  9. 1.Ubuntu查看Python版本

    1.输入命令:ls -l /usr/bin/python*

  10. Spring Security核心类关系图

    以有限的脑力记忆无限的Knowledge,多画图,多画图,多画图. 核心类Authentication 和 GrantedAuthority AbstractAuthenticationToken 由 ...