J. Divisibility time limit per test 0.5 seconds memory limit per test 64 megabytes input standard input output standard output IT City company developing computer games invented a new way to reward its employees. After a new game release users start…
 Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain…
题目:http://codeforces.com/problemset/problem/597/A 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 y…
Divisibility 我们考虑删数字 首先我们可以发现有一类数很特殊就是大于 n / 2的素数, 因为这些素数的贡献只有1, 并且在n大的时候, 这些素数的个数不是很少, 我们可以最后用这些数去调整, 并且删掉一个数的时候删掉的是它的因子个数, 所以可以用素数去控制最后的数量.当n小的时候直接状压枚举. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk mak…
题目链接  Divisibility 题意 给定$n$和$k$,构造一个集合$\left\{1, 2, 3, ..., n \right\}$的子集,使得在这个集合中恰好有$k$对正整数$(x, y)$, $x < y$ 满足$x$是$y$的约数. 选定$1$和$2$, 首先把满足 $x > [\frac{n}{2}]\ $的质数$x$留出来, 然后把满足 $ [\frac{n}{3}]\  < x <=  [\frac{n}{2}]\ $的质数,以及他们的两倍留出来,   留出来…
水题. #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #include<cstdio> using namespace std; long long k,L,R; int main() { scanf("%lld%lld%lld",&k,&L,&R); long…
解题思路: 只有尾数为25,50,75,00的数才可能是25的倍数. 对字符串做4次处理,以25为例. a. 将字符串中的最后一个5移到最后一位.计算交换次数.(如果没有找到5,则不可能凑出25,考虑50.75.00) b. 字符串已经改变,将此时最后一个2移到倒数第二位.计算交换次数. (如果没有找到2,则也不可能凑出25,考虑50.75.00) c. 将除了最后两位之外的第一个非0的数字移到首位,计算交换次数.(如果找不到除了最后两位之外的非0数字,则不可能凑出25,考虑50.75.00)…
C. Divisibility by Eight Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/C Description You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leadin…
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/problem/A 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 tha…
Codeforces Round #486 (Div. 3) E. Divisibility by 25 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/E Description You are given an integer n from 1 to 10^18 without leading zeroes. In one move you can swap any two adjacent digits in…