
math
RunningBeef
这个人很帅,所以……
展开
-
2021ccpc网络赛 Monopoly 不处理负模数做法
传送门Problem DescriptionLittle Rabbit loves playing a tabletop game called Monopoly. In the game, players roll the dice to move around the game board, buying and trading properties, and developing them with houses and hotels. Players collect rent from thei原创 2021-10-12 16:36:57 · 396 阅读 · 0 评论 -
nowcode 逆序对
题目链接:https://ac.nowcoder.com/acm/problem/14731来源:牛客网求所有长度为n的01串中满足如下条件的二元组个数:设第i位和第j位分别位ai和aj(i<j),则ai=1,aj=0。答案对1e9+7取模。输入描述:输入一个n。输出描述:输出答案对1e9+7取模示例1输入3输出6说明备注:n <= 10^18思路n数据可以很大,应该考虑推出公式直接求出答案根据题意,首先假设出一个长度适当的01串,试着原创 2021-08-11 10:57:35 · 203 阅读 · 0 评论 -
求1-n每个数的约数,约数和,约数对
时间复杂度 o(n * lnn)积分求n越大系数越大n = 1e7循环次数 1e9n = 1e6循环次数 1e7n = 1e5循环次数 1e6//包括这个数本身 for( int i = 1; i <= n; ++i ) for( int j = i ; j <= n; j += i) ++f[j];//不包括这个数本身 for( int i = 1; i <= n; ++i ) for原创 2021-05-26 12:57:25 · 789 阅读 · 0 评论 -
m个球中插入n个相同球的方案数
组合数学原创 2021-04-07 10:57:02 · 278 阅读 · 0 评论 -
逆序对 牛客每日一题
链接:https://ac.nowcoder.com/acm/problem/14731来源:牛客网求所有长度为n的01串中满足如下条件的二元组个数:设第i位和第j位分别位ai和aj(i<j),则ai=1,aj=0。答案对1e9+7取模。思路数据范围 n < 10^18,暴力肯定不太可能,应该考虑推公式根据题意,一个字符串所有满足题意的二元组个数为所有0位的前面的1的数量的和,或者每一个1位后面0的数量求和。这里说一下第一种对于所有可能的01串的前i-1位,1的个数有原创 2021-02-21 18:29:49 · 558 阅读 · 0 评论 -
邬澄瑶的公约数
不能先对所有底数求ans = gcd(ans,xi),再求每个xi^pi有多少个ans,这样得到的答案是错误的。例如样例输入28 42 3输出64结果自己那样做输出16就是没考虑ans = gcd(ans,xi)后xi/ans剩下的数,p次方后可以得到ans,比如 x =8,p = 2, x /4 = 2;2^2 = 4;正确的方法是,x = abc……x^p = a^p * b^p * c^p……;所以只要记录每个质因数的最小底数Pmin就可以得到an...原创 2021-02-20 00:04:25 · 224 阅读 · 0 评论