HDU6129 规律】的更多相关文章

LINK 题意:n个数进行m次前缀和异或和后的情况,其中$n,m(1\leq n\leq2\times10^5,1\leq m\leq10^9)$. 思路:看到m这么大,肯定要分解m的,又是异或和,二进制分解后,发现第i的位置上值为与i相距 [m分解后的各个值]位置上的异或,复杂度O(nlogm). /** @Date : 2017-08-18 16:10:51 * @FileName: 1010 规律.cpp * @Platform: Windows * @Author : Lweleth (…
给你数列a,问你对它作m次求前缀异或和之后的新数列是什么. 考虑a1对最终生成的数列的每一位的贡献,仅仅考虑奇偶性, 当m为2的幂次的时候,恰好是这样的 2^0 1 1 1 1 1 ... 2^1 1 0 1 0 1... 2^2 1 3个0 1 3个0 ... 2^3 1 7个0 1 7个0 ... 于是,从做了i次操作之后的序列,变换到做了i+2^k次操作之后的序列,可以轻松地通过 for i = 1 to n-2^k a(i+2^k) := a(i+2^k) xor a(i) [*] 这样…
Happy 2004 题意:s为2004^x的因子和,求s%29.     (题于文末) 知识点: 素因子分解:n = p1 ^ e1 * p2 ^ e2 *..........*pn ^ en 因子和:    Sum=(p1^0+p1^1-.p1^e1)*(p2^0+p2^1-p2^e2)--(pn^0+-pn^en) =; 积性函数:s(xy)=s(x)*s(y)    (比如:幂函数,因子和,欧拉函数,莫比乌斯函数) 对于正整数n的一个算术函数 f(n),若f(1)=1,且当a,b互质时f…
传送门 Description Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad. Let's consider the following algorithm of generating a…
//POJ3377 //DP解法-解有规律的最短路问题 //Time:1157Ms Memory:12440K #include<iostream> #include<cstring> #include<cstdio> using namespace std; #define MAXN 1000005 typedef long long LL; int n; int dp[MAXN][3]; int sr, st, er, ed; int main() { //freo…
A Simple Nim Problem Description   Two players take turns picking candies from n heaps,the player who picks the last one will win the game.On each turn they can pick any number of candies which come from the same heap(picking no candy is not allowed)…
--利用sqlserver来运算斐波那契规律 --利用事物与存储过程 declare @number intdeclare @A intdeclare @B intdeclare @C int set @A=1 set @B=2 set @Number=3 select @C=@A+@B while(@Number<60) begin    set @C=@A+@B  if(@@ERROR<>0)  goto errorhandler  print N'第'+convert(varcha…
黑莓末路 昨晚听FM里谈到了RIM这家公司,有分析师认为它需要很悲催的裁员90%,才能保证活下去.这是一个意料之中,但又有点兔死狐悲的消息.可能在不久的将来,RIM这家公司就会走到尽头,或被收购,或申请破产保护. RIM的黑莓手机以在911事件中仍然能够保持通信而名声大振,在此后美国政府与很多商务人士都采购了黑莓手机,由此黑莓把重点放在了安全性上.很遗憾的是,成也萧何败也萧何,黑莓从此以后错误的判断了智能手机的未来,一直死盯着安全与商务功能不放,最终走到了今天的地步. RIM的问题很多,比如在软…
Math.abs(~2018) 某前端群的入门问题长姿势了,一个简单的入门问题却引发了我的思考,深深的体会到自己在学习前端技术的同时忽略遗忘了一些计算机的基础知识. 对于 JS Math对象没什么可说的, Math.abs(x)指的是返回一个数的绝对值,而解题关键在“~2018”,乍一看,这是什么意思,不会是“-2018”符号打错了吧?细思一下才恍然大悟,这是取反操作符,故取相反数得结果为-2018,Math.abs(-2018) 即2018,大功告成!可是,输入进去发现,What!错误!Why…
COM中需要调用AddRef和Release的10条规律  …