codeforces 192A Funky Numbers】的更多相关文章

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k …
传送门 参考资料: [1]:CodeForces 55D Beautiful numbers(数位dp&&离散化) 我的理解: 起初,我先定义一个三维数组 dp[ i ][ j ][ k ]:来到 i 位置时,所有非零数的lcm = j,当前数位 k 时含有的 Beautiful numbers 的个数. 但是,由题意得,当前的数 k 可以是个很大的数(9e18),数组根本就开不下,那怎么办呢? 将当前的数 hash 一下,如何hash呢? 假设 a,b,c,d 为[0,9]的数,那么不存…
Codeforces 878 E. Numbers on the blackboard 解题思路 有一种最优策略是每次选择最后面一个大于等于 \(0\) 的元素进行合并,这样做完以后相当于给这个元素乘 \(2\) ,并且不使前面一个元素的值增加了.但是按照这样的策略做不太好维护,考虑做完以后有许多块,除了第一个块以外每一个块都是负的,然后将这些块与第一个块合并.那么用并查集维护一下每个块,每一个元素被乘 \(2\) 的次数就是这个块里面位置比它小的元素个数.定义一个块的和为每个元素乘上其对应系数…
Codeforces 55D. Beautiful numbers 题意 求[L,R]区间内有多少个数满足:该数能被其每一位数字都整除(如12,24,15等). 思路 一开始以为是数位DP的水题,觉得只需要记录搜到当前位出现了哪些数字作为状态即可,明显是假算法...感觉这是一道数位DP好题.可以这样思考:一个数要想被其各位数字分别都整除,等价于它被那些数字的LCM整除.因此记录当前位,当前数对(1~9的LCM)取模的结果,当前出现的数字的LCM这三个值作为状态才合理,即dp[pos][sum][…
 Phone Numbers Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 151B Description Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, ord…
D. Beautiful numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if…
E. Compatible Numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Two integers x and y are compatible, if the result of their bitwise "AND" equals zero, that is, a & b = 0. Fo…
题目:http://codeforces.com/gym/100338/attachments 贪心,每次枚举10的i次幂,除k后取余数r在用k-r补在10的幂上作为候选答案. #include<bits/stdc++.h> using namespace std; typedef unsigned long long ull; ; ull base[maxbit], n, k; void preDeal() { ] = ; ; i < maxbit; i++){ *]; } } voi…
wo integers x and y are compatible, if the result of their bitwise "AND" equals zero, that is, a&b = 0. For example, numbers90(10110102) and 36(1001002) are compatible, as 10110102&1001002 = 02, and numbers 3(112) and 6(1102) are not com…
D. Beautiful numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if…