- 博客(6)
- 收藏
- 关注
原创 大二第二周总结
差分数组就一个辅助数组,从侧面来表示给定某一数组的变化,一般用来对数组进行区间修改的操作对于区间(l,r)修改加n,我可以对d[l]+=n,d[r+1]-=n,这样你就不用操作o(n)次,只需要o(1)次。到后面操作完了就再a[n]=a[n-1]+d[i]就行差分数组的变形:对于这种第一个人发1个糖果,给他碰到的第二个人发2个糖果,给他碰到的第三个人发3个糖果…碰到的第k个人发k个糖果的,,我们可以这样:LL zz,tem; zz=tem=0; for(int i=1;i<
2021-09-13 23:22:53 52
原创 大二第一周小总结
取模运算正常的讲:(a+b)%mod==(a%mod+b%mod)%mod除法同理(ab)%mod==(a%modb%mod)%mod但是除法是个例外正常来讲,我们是将除法变成乘法来算的但是取模运算无法做到例如:5/4b=4/b即为1/4但是1/4是分数,无法取模因此这个思路就是错的所以还是得求逆元其实求逆元挺简单的,你只要有快速幂的基础就行了,快速幂的博客我就放着了:https://blog.csdn.net/qq_19782019/article/details/856
2021-09-05 14:30:19 64
原创 CF专题(长安大学)
来暂时总结下这几天的CF专题吧…后续还会更新…A - Ichihime and Triangle:Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.These days the temple is holding a math contest. Usually, Ichihime lacks interest in these things
2021-07-22 15:42:19 131
原创 2021-07-17
题目:B. Maximum Cost Deletiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n consisting only of the characters 0 and 1.You perform the following operation until
2021-07-17 11:48:58 55
原创 2021-01-30
总结C++中int型数据运算结果的取整:例如:a除以b:向下取整:int(a/b)向上取整:int(a+b-1)/b四舍五入:int(a/b+0.5),先将a与b转化成float/double,后运算。
2021-01-30 11:30:23 73
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人