题:https://codeforces.com/contest/1245/problem/F 分析:转化为:求区间内满足a&b==0的对数(解释见代码) ///求满足a&b==0在区间[l,r]的对数 ///推导:区间[2l,2r]可由[l,r]乘3倍得来 ///原因:*2我们可以看成事左移1位,那么这个位置上,对于俩个数来说 /////////可以取0,1 或1,0或0,0才依然满足 a&b==0这个题目条件 /////////这个公式可以用递归推导回溯计算, ////////…
B. Hamming Distance Sum   Genos needs your help. He was asked to solve the following programming problem by Saitama: The length of some string s is denoted |s|. The Hamming distance between two strings s and t of equal length is defined as , where si…
NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles: It turned out that the circles are equal. NN was very…
B. Wizards and Huge Prize Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/167/problem/B Description One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees. One of such ma…
这题明白的意思就是求n!在b进制下的后缀零的个数. 即最大的n!%(b^k)==0的k的值.我们需要将如果要构成b这个数,肯定是由一个个质因子相乘得到的.我们只需要求出b的质因子,然后分析n!中可以组成一个b的因子由多少个就可以了. 因为b是10的12次方,所以b的质因子某个因子大于了10的6次方,那肯定是质数了,所以我们只需要筛选出10的6次方以内的质因子就可以了,并且记录下每个质因子的基数. 最后是记录n!由多少个b的素因子组成并除以它的基数,取其中的最小值. n!中有多少个素因子(假设素因…
A. Buy a Shovel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is so…
C. An impassioned circulation of affection time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dian…
一.题目 D1. Submarine in the Rybinsk Sea (easy edition) 二.分析 简单版本的话,因为给定的a的长度都是定的,那么我们就无需去考虑其他的,只用计算ai的值在每个位置的贡献即可. 因为长度是定的,如果ai在前,那么对所有的a的贡献就是在偶数位的贡献值然后乘以n即可. 如果ai在后,那么对所有ai的贡献就是在奇数位的贡献值然后乘以n. 将两种情况合并,其实就是求ai在每个位置下的贡献,然后乘以n. 时间复杂度是$O(n)$ 三.AC代码 1 #incl…
C. Kleofáš and the n-thlon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/601/problem/C Description Kleofáš is participating in an n-thlon - a tournament consisting of n different competitions in n different disciplines (n…
A. Warrior and Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/594/problem/A Description In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this…