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. 03Microsoft SQL Server 数据类型

    Microsoft SQL Server 数据类型 数据类型 Number 类型: 数据类型 描述 存储 bit  允许0,1或NULL    tinyint 允许从 0 到 255 的所有数字. 1 ...

  2. Oracle XE WM_CONCAT undifine

    用docker 跑了个oracle XE 报错 没有WM_CONCAT    下载三个sql文件然后按顺序执行后可以正常使用 一:下载三个文件 解压到 oracle 目录下面 (要能找到,注意权限要o ...

  3. wpf 界面加载 Command

    导入 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" <i:Interaction. ...

  4. JAVA基础——Date和Calendar类

    1计算某一月份的最大天数 Calendar time=Calendar.getInstance(); time.clear(); time.set(Calendar.YEAR,year); //yea ...

  5. Find The Multiple POJ - 1426 (BFS)

    题目大意 给定一个整数,寻找一个只有0,1构成的十进制数使得这个数能够整除这个整数 解法 直接bfs第一位放入1,之后每一位放入1或者0 代码 #include <iostream> #i ...

  6. FileOutputStream将从一个文件中读取的内容写到另一个文件中

    package com.janson.day2018082 import java.io.FileInputStream; import java.io.FileNotFoundException; ...

  7. LINUX-磁盘空间

    df -h 显示已经挂载的分区列表 ls -lSr |more 以尺寸大小排列文件和目录 du -sh dir1 估算目录 'dir1' 已经使用的磁盘空间' du -sk * | sort -rn ...

  8. App后台开发运维和架构实践学习总结(4)——APP的注册和登录功能设计

    一.为什么需要注册和登录? 是否需要注册和登录的关键取决于产品形态. 如果用户注册登录对于用户需求.产品功能.商业模式本身带不来任何价值的话,就没必要设计这样的功能.比如一些实用工具类的产品:计算器. ...

  9. 【BZOJ4514】数字配对(费用流)

    题意: 有 n 种数字,第 i 种数字是 ai.有 bi 个,权值是 ci. 若两个数字 ai.aj 满足,ai 是 aj 的倍数,且 ai/aj 是一个质数, 那么这两个数字可以配对,并获得 ci× ...

  10. 串口调试助手---VB源码

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/ ...