HDOJ-2110 Crisis of HDU(母函数)
来源:互联网 发布:java树形结构简单实现 编辑:程序博客网 时间:2024/06/05 06:43
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <vector>#include <climits>#include <set>using namespace std;#define maxn 100int p[maxn], m[maxn], c1[maxn*maxn], c2[maxn*maxn];int main(){// freopen("in.txt", "r", stdin); int n; while(cin >> n && n) { for(int i = 0; i < n; i++) { cin >> p[i] >> m[i]; } memset(c1, 0, sizeof(c1)); memset(c2, 0, sizeof(c2)); int s = 0; c1[0] = 1; c2[0] = 1; for(int i = 0; i < n; i++) { for(int j = 0; j <= s; j++) for(int k = 1; k <= m[i]; k++) { int t = j + k * p[i]; c2[t] += c1[j]; c2[t] %= 10000; } s += p[i] * m[i]; for(int i = 0; i <= s; i++) { c1[i] = c2[i]; } } if(s % 3 == 0) cout << c1[s/3] << endl; else cout << "sorry" << endl; } return 0;}
0 0
- HDOJ-2110 Crisis of HDU(母函数)
- HDOJ--2110Crisis of HDU!母函数
- 母函数系列之Crisis of HDU hdoj 2110
- hdu 2110 Crisis of HDU(母函数)
- HDU 2110 Crisis of HDU 母函数
- Hdu 2110 Crisis of HDU 母函数
- HDU 2110 Crisis of HDU 母函数
- hdu 2110 Crisis of HDU(母函数)
- HDU 2110-Crisis of HDU(母函数)
- HDU 2110 Crisis of HDU 【母函数】
- Crisis of HDU 2110 (母函数)
- Crisis of HDU+母函数
- HDOJ 题目题目2110(Crisis of HDU)(母函数)
- HDU 2110 Crisis of HDU (母函数问题)
- hdu 2110 Crisis of HDU(母函数)
- HDU2110 Crisis of HDU【母函数】
- Crisis of HDU 还是母函数
- Crisis of HDU(hdu2110)母函数
- android
- 十六进制转十进制
- [LeetCode]198. House Robber
- 逻辑主键 与 业务主键
- VMware下的RHEL 6.4 安装gcc和gcc-c++
- HDOJ-2110 Crisis of HDU(母函数)
- 三层架构实战篇—系统登录实例
- CSS3实现手机1px边框,细如发丝
- 【Codeforces613B】Skills【二分】【枚举】【贪心】
- myeclipse10的Mybatis插件 Generator最完整配置详解
- Java常识之-注解
- 学习笔记之--post/get/put
- c++学习笔记之拷贝
- 互联网+浪潮席卷而至 移动办公潜能无限