![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
酸不溜湫的梅子
想要成为一名合格的acmer!带着队友乘风破浪,好吧,感觉更大的可能是队友带着我乘风破浪 无论如何都要努力!哪怕很慢,哪怕很笨....
展开
-
lucas定理 给自己打个板子!
定理很有用C(n,m)=C(n%mod,m%mod)*C(n/mod,m/mod);#include<iostream>#include<cstdio>using namespace std;#define ll long longconst ll int MAX_N = 1e5 + 10;#define bug(x) cout<<#x<<" == "<<x<<endl;ll mod ;ll a[MAX_N]= {0}原创 2021-07-22 15:33:24 · 90 阅读 · 0 评论 -
race(数论,组合,递推)
链接:https://vjudge.net/problem/UVA-12034First:首先我们可以根据紫书上的思路来设n个人的名次可能为f(n)假设第一名有i个人,i个人是第一名的组合是C(n,i)后面的n-i个人就是f(n-i)所以f(n)=C(n,1)f(n-1)+C(n,2)f(n-2)+…+C(n,n)f(0)所以最后一项为前n个人并列第一名C(n,n)为1要提前设置为f(0)为1结果我发现这样子会爆long long 而且在计算组合数的时候我利用了公式C(n,k+1)=(n-k原创 2021-07-14 14:15:05 · 210 阅读 · 1 评论 -
一个数的约数和,约数个数问题
一个数的约数个数#include<bits/stdc++.h>using namespace std;#define INF 0x3f3f3f3ftypedef long long ll;typedef unsigned long long ull;#define speed(x) ios::sync_with_stdio(false), cin.tie(x), cout.tie(x)#define bug(x) cout << #x << " == " &原创 2021-07-13 18:27:03 · 88 阅读 · 0 评论 -
Probability|Given (概率)
把在n个人中m个人买了东西的总概率算出来用dfs搜索每一种情况就好#include<bits/stdc++.h>#define INF 0x3f3f3f3f#define ll long long#define speed(x) ios::sync_with_stdio(false), cin.tie(x), cout.tie(x)#define bug(x) cout << #x << " == " << x << '\n';con原创 2021-07-12 19:06:07 · 236 阅读 · 0 评论 -
唯一分解定理
题目Bi-shoe and Phi-shoehttps://vjudge.net/problem/LightOJ-1370一个简单的欧拉筛就完事啦!#include<iostream>#include<algorithm>#include<cstdio>using namespace std;#define ll long long#define bug(x) cout << #x << " == " << x <原创 2021-07-09 13:51:57 · 53 阅读 · 0 评论 -
Send a Table (欧拉函数)
#include<bits/stdc++.h>#define INF 0x3f3f3f3f#define ll long long#define speed(x) ios::sync_with_stdio(false), cin.tie(x), cout.tie(x)#define bug(x) cout << #x << " == " << x << '\n';const ll int MAX_N = 3e6 + 5;using na原创 2021-07-12 16:44:00 · 140 阅读 · 0 评论