![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
组合数学
文章平均质量分 60
zhengnanlee
这个作者很懒,什么都没留下…
展开
-
poj3252
第一道组合数学题,连跪一天。。原创 2013-08-06 23:00:07 · 3961 阅读 · 1 评论 -
Recent Contest #1(Mar 18-Mar24, 2014)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=42423#overviewA水题不述B题是重点公式不难想:直接算肯定坑爹,有三种优化方法:1、巧妙地乘法:double calc(int n, double p) { double ans = n * p; double temp =原创 2014-03-25 21:11:27 · 1366 阅读 · 0 评论 -
poj1850
可以算组合吗?长度为2的字母,一共有C(26,2)个,这很难理解么?然后推一下当前要算的字母在哪个位置即可了。#include #include "string"using namespace std;int c[27][27];void combinations(){ for (int i = 0; i <= 26; i++) { for (int j = 0; j原创 2014-01-17 18:41:29 · 1776 阅读 · 0 评论 -
poj1019
暑假一直没过,这次过了。。不易- -。10算两位数哦~#include #include using namespace std;#define M 50000long long a[M], s[M];void init() { a[1] = s[1] = 1; for (int i = 2; i < M; i++) { a[i] = a[i - 1] + (int)原创 2014-01-23 17:02:36 · 1010 阅读 · 0 评论 -
poj2154
进军高级。高级题?。。欧拉函数(求比它小的数跟它互质的个数)优化polya定理。楼教主的题?。。#include using namespace std;int plist[10000], pcount = 0;int modular_exponent(int a, int b, int n){ //a^b mod n int ret原创 2013-10-17 20:58:59 · 783 阅读 · 0 评论 -
poj3286
又发现中级水题一枚。。高中貌似老师讲过?#include #include #include using namespace std;#define LL long longLL radix[15], n, m;LL cal(LL x){ if (x0) return 0; LL sum = 1;原创 2013-10-11 11:07:44 · 1123 阅读 · 0 评论 -
UVa10970
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1911思路很简单。把大块m行n列的巧克力的切成1为宽度,长度为m的小块,这样是n-1刀,然后有n个这样的小块,每个再这么切,每个需要m-1刀。#include using namespace原创 2013-05-14 13:30:32 · 838 阅读 · 0 评论 -
UVa11401
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2396组合。过后再写推导过程。#includeusing namespace std;const int maxn=1000010;long long num[maxn];int ma原创 2013-05-19 22:41:58 · 862 阅读 · 0 评论 -
快速组合数
递推公式很简单:C(n,k+1) = C(n,k) * (n-k) / (k + 1)方法很暴力经测,C(2000,1000)可以求出,C(2000,0)到C(2000,2000)所用时间仅需0.2s#include #include #include #include #include #include using namespace std;const int原创 2013-08-03 11:10:34 · 1313 阅读 · 0 评论 -
poj1942
高中就见过。注意组合数优化和7/2=3这种情况#include #include using namespace std;#define ULL unsigned long long intint main(){ ULL a, b; while (cin >> a >> b && (a || b)) { if (b > a) swap(a, b); ULL s =原创 2013-08-07 10:01:02 · 1261 阅读 · 3 评论 -
poj1286
Polya计数原理第一题。基本应用。注释写得很清楚了,不再赘述。/*************************************************************************> File Name: poj1286.cpp> Author: zhengnanlee > Mail: zhengnanlee@hotmail.com > Creat原创 2013-09-19 16:37:38 · 1112 阅读 · 0 评论 -
poj2409
polya第二题,没有难度。/************************************************************************* > File Name: poj2409.cpp > Author: zhengnanlee > Mail: zhengnanlee@hotmail.com > Created Time: 2013年原创 2013-09-24 16:39:26 · 1216 阅读 · 1 评论 -
poj2891???
简单组合。/*************************************************************************> File Name: poj2891.cpp> Author: zhengnanlee > Mail: zhengnanlee@hotmail.com > Created Time: 2013年09月18日 星期三 14原创 2013-09-19 08:55:46 · 1625 阅读 · 0 评论