1 Star 0 Fork 0

util6/算法刷题c++

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Acwing1023_BuyBook.cpp 412 Bytes
一键复制 编辑 原始数据 按行查看 历史
util6 提交于 2021-08-12 16:13 +08:00 . 默认的
//
// Created by 95853 on 2021/7/24.
//
/**
* http://ybt.ssoier.cn:8088/problem_show.php?pid=1293
*/
#include "iostream"
using namespace std;
int v[4] = {10,20,50,100};
int m,dp[1010];
int main(){
int n = 4;
cin>>m;
dp[0] = 1;
while (n--){
for(int i = 0; i <=m; i++) {
if (i>=v[n]){
dp[i] += dp[i-v[n]];
}
}
}
cout<<dp[m]<<endl;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuyutaocode/cppCode.git
git@gitee.com:liuyutaocode/cppCode.git
liuyutaocode
cppCode
算法刷题c++
master

搜索帮助