完全背包。

直接做个背包容量为$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. devDependencies 和 dependencise 的区别

    在使用 npm install 安装模块或者插件的时候,在命令中可以添加俩种参数把他们写入到 pakeage.json 文件里面去: --save ( 简写 -S ) --save-dev ( 简写 ...

  2. svn稀疏目录--通过设置工作目录的深度(depth)实现目录树的部分签出

    对于一个大的版本库来说,本地工作目录签出整个目录树是即费时又占地儿的.虽然可以只签出某个子目录树,但有时候还是需要从根目录签出.那么,怎么才能只把自己感兴趣的子目录签出来呢? 从svn1.5版开始,提 ...

  3. 「模板」「讲解」Treap名次树

    Treap实现名次树 前言 学平衡树的过程可以说是相当艰难.浏览Blog的过程中看到大量指针版平衡树,不擅长指针操作的我已经接近崩溃.于是,我想着一定要写一篇非指针实现的Treap的Blog. 具体如 ...

  4. Bat 命令相关

    1. bat 里面怎么sleep 等待: ping 127.0.0.1 -n 2000 > nul 2. net use 建立映射: net use Y: \\172.16.10.240\Inf ...

  5. 【BZOJ4868】期末考试 [三分][贪心]

    期末考试 Time Limit: 20 Sec  Memory Limit: 512 MB[Submit][Status][Discuss] Description Input Output Samp ...

  6. UITableView---iOS-Apple苹果官方文档翻译

    本系列所有开发文档翻译链接地址:iOS7开发-Apple苹果iPhone开发Xcode官方文档翻译PDF下载地址  //转载请注明出处--本文永久链接:http://www.cnblogs.com/C ...

  7. Super A^B mod C (快速幂+欧拉函数+欧拉定理)

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1759 题目:Problem Description Given A,B,C, You should quick ...

  8. 简述--构建React项目的几种方式

    前言: 构建React项目的几种方式: 构建:create-react-app 快速脚手架 构建:generator-react-webpack 构建:webpack一步一步构建 1)构建:creat ...

  9. MySQL:Can't create test file XXX.lowe-test

    问题说明 今天部署MySQL,在使用mysql_install_db,初始化数据库时报如下错误 180622 11:36:38 mysqld_safe Starting mysqld daemon w ...

  10. android datepicker timepicker简单用法

    1.效果图 2. xml布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout x ...