摘要:
题目:http://acm.hit.edu.cn/hoj/problem/view?id=1402整数划分问题Submitted: 886,Accepted: 374整数划分是一个经典的问题。希望这道题会对你的组合数学的解题能力有所帮助。Input每组输入是两个整数n和k。(1 <= n <= 50, 1 <= k <= n)Output对于每组输入,请输出六行。第一行: 将n划分成若干正整数之和的划分数。第二行: 将n划分成k个正整数之和的划分数。第三行: 将n划分成最大数不超过k的划分数。第四行: 将n划分成若干奇正整数之和的划分数。第五行: 将n划分成若干不同整数 阅读全文
摘要:
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3374最小表示法:http://tobyaa.blog.163.com/blog/static/30248591201261604349913/#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;const int maxn = 1000005;char str[maxn];int next[maxn];void ge 阅读全文
摘要:
/* 对于小数据用这dfs,大数据就用递推的思想。*/#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <queue>#include <map>#include <stack>#include <vector>using namespace std ;const int maxn = 20 阅读全文
摘要:
题目:http://codeforces.com/contest/304/problem/B#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <fstream>#include <vector>#include <map>#include <queue>#include <stack& 阅读全文