Testing Round #12 A,B,C 讨论,贪心,树状数组优化dp
标签:torratenesspacetestcommrestincludeblog
题目链接:http://codeforces.com/contest/597
A. Divisibility
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Find the number ofk-divisible numbers style=\”font-size: 17.5px; font-family: ‘times new roman‘, sans-serif; white-space: nowrap;\”>[a, b]. In other words you need to find the number of such integer valuesxthata ≤ x ≤ bandxis divisible byk.
Input
The style=\”font-size: 17.5px; font-family: ‘times new roman‘, sans-serif; white-space: nowrap;\”>k,aandb(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
题意:找出[a,b]区间内整除k的数的个数;
思路:小心点特判即可;
#pragma comment(linker, \”/STACK:1024000000,1024000000\”)
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstring>
#include<vector>
#include<list>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pi (4*atan(1.0))
#define eps 1e-14
#define bug(x) cout<<\”bug\”<<x<<endl;
const int N=1e5+10,M=4e6+10,inf=2147483647;
const