完全背包。

直接做个背包容量为$100000$的完全背包,这样就可以避免繁琐的分类讨论了。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<ctime>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0);
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar();
x = ;
while(!isdigit(c)) c = getchar();
while(isdigit(c))
{
x = x * + c - '';
c = getchar();
}
} long long n,a,b,c;
long long x[]; int main()
{
cin>>n>>a>>b>>c; for(int i=;i<=;i++) x[i]=i*a;
for(int i=;i<=;i++) x[i]=min(x[i],x[i-]+b);
for(int i=;i<=;i++) x[i]=min(x[i],x[i-]+c); long long ans=-;
for(int i=;i<=;i++)
{
if((n+i)%==)
{
if(ans==-) ans=x[i];
else ans=min(ans,x[i]);
}
}
cout<<ans<<endl;
return ;
}

CodeForces 740A Alyona and copybooks的更多相关文章

  1. Codeforces 740A. Alyona and copybooks 模拟

    A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...

  2. Codeforces Round #381 (Div. 2)A. Alyona and copybooks(dfs)

    A. Alyona and copybooks Problem Description: Little girl Alyona is in a shop to buy some copybooks f ...

  3. Codeforces E. Alyona and a tree(二分树上差分)

    题目描述: Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. 【20.23%】【codeforces 740A】Alyona and copybooks

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. Codeforces 740C. Alyona and mex 思路模拟

    C. Alyona and mex time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...

  6. Codeforces 777C Alyona and Spreadsheet

    C. Alyona and Spreadsheet time limit per test:1 second memory limit per test:256 megabytes input:sta ...

  7. codeforces 682C Alyona and the Tree(DFS)

    题目链接:http://codeforces.com/problemset/problem/682/C 题意:如果点v在点u的子树上且dist(u,v)>a[v]则u和其整个子树都将被删去,求被 ...

  8. CodeForces 682D Alyona and Strings (四维DP)

    Alyona and Strings 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/D Description After re ...

  9. CodeForces 682C Alyona and the Tree (树+dfs)

    Alyona and the Tree 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/C Description Alyona ...

随机推荐

  1. [LeetCode] Sort Colors 对于元素取值有限的数组,只遍历一遍的排序方法

    Given an array with n objects colored red, white or blue, sort them so that objects of the same colo ...

  2. 2015/8/10 Python基本使用(1)

    此文为<Python核心编程>的读书笔记记录. Python是一门解释性语言,所有的语句用解释器(interpreter)来直接解释,但它同时是High Level的语言,这样的组成能够在 ...

  3. Mybatis xml 写sql如何判断集合的size

    在mybtis的映射文件中判断集合大小  list.size  例子如下: <if test="groupIds != null and groupIds.size>0" ...

  4. Vs2013 agent 安装

    1. 在windows 2008 R2上安装vs2013 agents需要满足: 1) .net 3.5 2) sp1补丁包(同windows7 sp1) 2. 安装vs2013 agents 步骤如 ...

  5. [J]computer network tarjan边双联通分量+树的直径

    https://odzkskevi.qnssl.com/b660f16d70db1969261cd8b11235ec99?v=1537580031 [2012-2013 ACM Central Reg ...

  6. 深入分析Spring 与 Spring MVC容器(山东数漫江湖)

    1 Spring MVC WEB配置 Spring Framework本身没有Web功能,Spring MVC使用WebApplicationContext类扩展ApplicationContext, ...

  7. 大聊Python----json与pickle数据序列化

    用于序列化的两个模块 ☆json,用于字符串和python数据类型间进行转换 ☆pickle,用于python特有的类型和python的数据类型间进行转换 Json模块提供了四个功能:dumps.du ...

  8. feign hystrix 线程池伸缩控制

    当前使用的版本 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spr ...

  9. javascript中=、==与===的区别

    1.等号 =赋值运算符,给变量赋值 var a="1"; 2.相等和不相等操作符 相等操作符由==表示,若两个操作数相等,则返回true:不相等操作符由!=表示,若两个操作数不相等 ...

  10. 转 一次完整地http请求

    作者:斯巴达克斯 时间:January 11, 2014 分类:WEB 声明:本文章中的说法仅是个人理解总结,不一定完全正确,但是可以有助于理解. 关于HTTP协议可以参考以下: HTTP协议漫谈 h ...