BZOJ 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店 dp+高精度
来源:互联网 发布:trunk端口配置代码 编辑:程序博客网 时间:2024/06/05 12:38
1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店
Time Limit: 5 Sec Memory Limit: 64 MB
Submit: 637 Solved: 321
[Submit][Status][Discuss]
Description
Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for
约翰到奶牛商场里买工具.商场里有K(1≤K≤100).种工具,价格分别为1,2,…,K美元.约翰手里有N(1≤N≤1000)美元,必须花完.那他有多少种购买的组合呢?
Input
A single line with two space-separated integers: N and K.
仅一行,输入N,K.
Output
A single line with a single integer that is the number of unique ways FJ can spend his money.
不同的购买组合数.
Sample Input
5 3
Sample Output
5
HINT
Source
Silver
题解:
第一次看到这道题,woc这不傻逼题吗,水了水了。。
然后才发现答案有多大,要用高精来存。恰好初赛考了然而我高精也确实忘得差不多了……就当复习高精了吧。
#include<bits/stdc++.h>using namespace std;const int K = 40 + 5;const int N = 1000 + 10;int n,k;int f[N][K];int main(){ scanf("%d%d",&n,&k); memset(f,0,sizeof(f)); int cnt=0;f[0][++cnt]=1; for(int i=1;i<=k;++i){ for(int j=i;j<=n;++j){ for(int d=1;d<=cnt;++d) f[j][d]+=f[j-i][d]; for(int d=1;d<=cnt;++d){ f[j][d+1]+=f[j][d]/10; f[j][d]%=10; } if(f[j][cnt+1]!=0) ++cnt; } } for(int i=cnt;i>=1;--i) printf("%d",f[n][i]); return 0;}
- BZOJ 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店 dp+高精度
- 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店 (完全背包+高精度)
- BZOJ 1655 [Usaco2006 Jan] Dollar Dayz 奶牛商店 完全背包
- |BZOJ 1655|无限背包|高精度|[Usaco2006 Jan] Dollar Dayz 奶牛商店
- bzoj 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店(高精度完全背包)
- BZOJ 1655 [Usaco2006 Jan] Dollar Dayz 奶牛商店 01背包+高精度
- 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店
- bzoj1655 [Usaco2006 Jan] Dollar Dayz 奶牛商店
- [Usaco2006 Jan] Dollar Dayz 奶牛商店
- bzoj1655 [Usaco2006 Jan] Dollar Dayz 奶牛商店(完全背包+高精)
- POJ 3181 Dollar Dayz (DP+高精度)
- [POJ 3181]Dollar Dayz[DP][高精度]
- Dollar Dayz POJ - 3181 dp,完全背包,简单高精度加法
- BZOJ 1654: [Usaco2006 Jan]The Cow Prom 奶牛舞会
- 【BZOJ】1654: [Usaco2006 Jan]The Cow Prom 奶牛舞会
- BZOJ 1635: [Usaco2006 Jan]The Cow Prom 奶牛舞会 tarjan
- bzoj 1720: [Usaco2006 Jan]Corral the Cows 奶牛围栏 二分
- 【例题】【背包DP&高精度】NKOJ3819 奶牛商店
- 卷积神经网络的参数维度(15)---《深度学习》
- D
- 单词翻转
- HTTPS(Hypertext Transfer Protocol Secure)安全超文本传输协议
- esayUI 鼠标悬停提示
- BZOJ 1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店 dp+高精度
- c++的访问权限和继承方式
- [SCOI2008]奖励关
- Vuforia VirtualButoon
- cf——B. Garland (桶排思想)
- 随想录(用python预测未来中国的GDP)
- eclipse中字母大小写转换快捷键
- 树链剖分 模板 洛谷P3384
- RDD实现