ICode9

精准搜索请尝试: 精确搜索
  • Pollard_Rho 算法2020-03-09 14:53:43

    Pollard_Rho 以下为分解最大质因子代码。 #include <ctime> #include <iostream> using i64 = long long; #define DEBUG() std::cerr << __FUNCTION__ << " " << __LINE__ << std::endl #define ctz __builtin_ctzll i64 gcd(i64 a, i64

  • 51nod1252 桥与海港2020-02-01 22:52:18

    Link 搞啥不好搞非素数模数。 先枚举港口并将其视为根,那么要算的就是根的儿子数均\(\le k\)的方案数。 考虑枚举根的总儿子数\(x\),选出这些儿子有\({n-m\choose x}\)种方案,把\(x\)个儿子挂在\(m\)个根上的方案数设为\(f_{x,m}\),然后把根删掉,剩下的就是\(n-m\)个点构成\(x\)棵有

  • CF1007E Mini Metro2020-02-01 22:00:10

    Link 题解看这个吧,写的很详细Link。 #include<cstdio> #include<numeric> #include<cstring> using std::partial_sum; using i64=long long; const int N=253;const i64 inf=0x3f3f3f3f3f3f3f3fll; int read(){int x;scanf("%d",&x);return x;} i64 a

  • Codeforces 1251D Salary Changing2019-12-03 23:01:52

    D. Salary Changing 大意: 有n个变量, 每个变量有一个取值区间, 要求给这n个变量赋值, 使得n个变量的和不超过S且中位数尽量大(n一定为奇数) 二分答案, 中位数大于等于mid就是问能不能有(n+1)/2个变量的值大于等于mid, 排序贪心就完事了. #include<cstdio> #include<algorithm> us

  • 整数快速幂2019-10-20 17:52:18

    https://www.cnblogs.com/sun-of-Ice/p/9330352.html typedef long long ll;ll mod;ll qpow(ll a, ll n)//计算a^n % mod{ ll re = 1; while(n) { if(n & 1)//判断n的最后一位是否为1 re = (re * a) % mod; n >>= 1;//舍去n的最后一位

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有