hdu 6092 Rikka with Subset
来源:互联网 发布:ipad怎么开淘宝网店 编辑:程序博客网 时间:2024/05/20 20:21
自己还是好菜啊。没想到背包。
#include<cstdio>#include<cstring>using namespace std;const int maxn = 1e5;typedef long long ll;ll a[maxn];ll f[maxn];ll c[maxn];int main(){ ll T, n, m; scanf("%lld", &T); while(T--){ int tot = 0; memset(f, 0, sizeof(f)); memset(c, 0, sizeof(c)); scanf("%lld%lld", &n, &m); for(int i = 0; i <= m; i++){ scanf("%lld", &a[i]); } f[0] = 1; for(int i = 1; i <= m; i++){ a[i] -= f[i]; c[i] = a[i]; if(c[i]) { for(int j = 1; j <= c[i]; j ++){ for(int k = m; k >= i; k--){ f[k] += f[k - i]; } } } } tot = 0; for(ll i = 1; i <= m; i++){ for(ll j = 1; j <= c[i]; j++){ printf("%lld%c", i, " \n"[++tot == n]); } } } return 0;}
阅读全文
0 0
- hdu 6092 Rikka with Subset
- HDU 6092:Rikka with Subset
- hdu 6092 Rikka with Subset
- HDU 6092 Rikka with Subset
- HDU 6092 Rikka with Subset
- HDU 6092 Rikka with Subset
- hdu 6092 Rikka with Subset
- HDU 6092Rikka with Subset
- hdu 6092 Rikka with Subset
- HDU 6092 Rikka with Subset
- [HDU 6092] Rikka with Subset
- hdu--6092--Rikka with Subset
- HDU 6092 ( Rikka with Subset )
- HDU 6092 Rikka with Subset
- HDU 6092-Rikka with Subset
- HDU 6092 Rikka with Subset
- Rikka with Subset HDU
- Rikka with Subset HDU
- Redis数据类型
- Java 常量定义-枚举enum
- GitHub上传文件
- 地图
- HDU 6071
- hdu 6092 Rikka with Subset
- Dreamoon and Sets CodeForces
- 获取iframe中的元素
- stm32 蓝牙 智能小车
- 1_SQL简单的查询语句
- 配置虚拟主机
- javscript练习(三)
- DIV CSS Sprites精灵 CSS图像拼合 CSS背景贴图定位教程案例
- pandas 终极版5: 字符串和缺失值处理