#include<bits/stdc++.h>
using namespace std;
const int maxn = 4000 + 131;
int n, a, b, c;
int Dp[maxn]; int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> a >> b >> c;
memset(Dp,0,sizeof(Dp));
Dp[a] = Dp[b] = Dp[c] = 1;
for(int i = 0; i <= n; ++i)
{
/// 前一种状态必须是被填过的
if(i >= a && Dp[i-a]) Dp[i] = max(Dp[i], Dp[i-a]+1);
if(i >= b && Dp[i-b]) Dp[i] = max(Dp[i], Dp[i-b]+1);
if(i >= c && Dp[i-c]) Dp[i] = max(Dp[i], Dp[i-c]+1);
}
cout << Dp[n] << endl;
}

CF 189A Cut Ribbon的更多相关文章

  1. 【CF 189A Cut Ribbon】dp

    题目链接:http://codeforces.com/problemset/problem/189/A 题意:一个长度为n的纸带,允许切割若干次,每次切下的长度只能是{a, b, c}之一.问最多能切 ...

  2. Codeforces 189A. Cut Ribbon

    题目链接:http://codeforces.com/problemset/problem/189/A 题意: 给你一个长度为 N 的布条, 再给你三个长度 a, b , c.你可以用剪刀去剪这些布条 ...

  3. Codeforces Round #119 (Div. 2) Cut Ribbon(DP)

    Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  4. Codeforces Round #119 (Div. 2)A. Cut Ribbon

    A. Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. Codeforces 189A:Cut Ribbon(完全背包,DP)

    time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : ...

  6. Cut Ribbon

    Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the follo ...

  7. [CF189A]Cut Ribbon(完全背包,DP)

    题目链接:http://codeforces.com/problemset/problem/189/A 题意:给你长为n的绳子,每次只允许切a,b,c三种长度的段,问最多能切多少段.注意每一段都得是a ...

  8. Codeforces Round #119 (Div. 2)

    A. Cut Ribbon \(f(i)\)表示长为\(i\)的布条最多可以剪几段. B. Counting Rhombi \(O(wh)\)枚举中心计算 C. Permutations 将序列一映射 ...

  9. DP擎天

    DP! 黄题: 洛谷P2101 命运石之门的选择 假装是DP(分治 + ST表) CF 982C Cut 'em all! 树形贪心 洛谷P1020 导弹拦截 单调队列水题 绿题: 洛谷P1594 护 ...

随机推荐

  1. C#中ICollection介绍

    ICollection 接口是 System.Collections 命名空间中类的基接口,ICollection 接口扩展 IEnumerable,IDictionary 和 IList 则是扩展 ...

  2. Tornado的异步非阻塞

    阻塞和非阻塞Web框架 只有Tornado和Node.js是异步非阻塞的,其他所有的web框架都是阻塞式的. Tornado阻塞和非阻塞两种模式都支持. 阻塞式: 代表:Django.Flask.To ...

  3. springboot(十三):springboot结合mybatis generator逆向工程自动生成代码

    错信息generate failed: Exception getting JDBC Driver: com.mysql.jdbc.Driver 上网查了一下,发现原来是generator这个插件在运 ...

  4. 关于HTTP的笔记

    网上看了一篇关于HTTP的博客,觉得还不错,这里就记下来了. 参考:https://www.cnblogs.com/guguli/p/4758937.html 一.主要特点 1.支持客户/服务器模式2 ...

  5. Webpack2学习记录-2

    这篇在 webpack-demo 目前下新建一个 w2 目录,学习 webpack.config.js 及 与 npm scripts 的使用. 1.w2 下新建一个 webpack.config.j ...

  6. UIScrollView嵌套的完美解决方案

    UIScrollView嵌套的完美解决方案 做iOS开发,不可避免的会遇到UIScrollView的嵌套问题,之前也曾遇到过,吭哧吭哧做完了,效果不理想,和产品大战好几回合,就那样了.不可避免的,又一 ...

  7. jupyter notebook出现cannot import name 'create_prompt_application'问题(Died Kernel)

    应该是在安装其它python第三方库时更新了prompt-toolkit版本,降级到下面的版本即可: sudo pip install 'prompt-toolkit==1.0.15'

  8. Hadoop之YARN思维导图

  9. if 语句

    if 判断条件的时候,如果是多个条件一起进行判断,那么就需要逻辑运算符   并且-----------and 或者-----------or 非(取反)----not   if 条件1 and 条件2 ...

  10. 百度地图API的应用

    做网页的时候,有时候需要有地图的功能.接下来我来记录一下我的做法. 1.引入API秘钥,在网上都可以搜到. <script src="http://api.map.baidu.com/ ...