#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. windows 使用 php 的exif 问题 Call to undefined function exif_imagetype()

    保证 extension=php_mbstring.dll 在 extension=php_exif.dll 之前

  2. 错误 1 未能找到类型或命名空间名称“DataPager”(是否缺少 using 指令或程序集引用?)

    鄙人在设计器SearchTab.xaml中添加了如下一个分页控件: <sdk:DataPager x:Name="dataPagerPrj" Grid.Row="3 ...

  3. IDApython教程(一)

    IDAPython是IDA的一个功能强大的扩展特性,对外提供了大量的IDA API调用.另外,还能在使用python 脚本语言的过程中获得能力提升,所以我强烈推荐所有的逆向工程师使用它. 然而不幸的是 ...

  4. dbms_redefinition在线重定义表结构 可以在表分区的时候使用

    dbms_redefinition在线重定义表结构 (2013-08-29 22:52:58) 转载▼ 标签: dbms_redefinition 非分区表转换成分区表 王显伟 在线重定义表结构 在线 ...

  5. Python之线程 3 - 信号量、事件、线程队列与concurrent.futures模块

    一 信号量 二 事件 三 条件Condition 四 定时器(了解) 五 线程队列 六 标准模块-concurrent.futures 基本方法 ThreadPoolExecutor的简单使用 Pro ...

  6. Python读取导入非安装文件库的方法

    一.将文件库放到和.py文件同一目录下: 二..py文件头导入文件库的格式为(以导入CIFAR-10数据的类为例)[其实就在文件库前面加个.]: from .cifar10 import cifar1 ...

  7. Intellij idea安装

    1.官网下载 官网: https://www.jetbrains.com/idea/ 旗舰版(涵盖所有功能的)和社区版 2.下载旗舰版 3.创建maven项目 IDE的设置 setting:当前项目的 ...

  8. 源码解读-文件上传angularFileUpload1

    angular-file-upload 1.文件上传模块的引入就不赘述,简单准备 2.初始化组件并绑定change事件 3.监听用户选择文件FileItem(change事件),push进文件数组qu ...

  9. day 5 - 1 字典(dict)

    dict dict key 必须是不可变数据类型,可哈希value:任意数据类型 dict 优点:使用二分查询来搜索数据存储了大量的关系型数据特点:无序的 数据类型划分:可变数据类型,不可变数据类型不 ...

  10. Springboot实体类转JSON报错Could not find acceptable representation & 设置访问项目根路径的默认欢迎页面

    =================实体类转JSON报错的解决办法============= 之前在springmvc的时候也报过这个错,原因以及springmvc中解决办法参考:https://www ...