完全背包。

直接做个背包容量为$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. SpringMVC+MyBatis开发中指定callSettersOnNulls,可解决返回字段不全的问题

    Spring+MyBatis开发过程中,在xxMapper.xml配置文件进行select查询时resultType="map",如果要查询的字段是空值,在返回的map中会出现找不 ...

  2. poj 2541 Binary Witch

    Binary Witch http://poj.org/problem?id=2541 Time Limit: 1000MS   Memory Limit: 65536K       Descript ...

  3. jsp 内置对象二

    1.什么是session ? (1)session 表示客户端与服务器的一次回话. 2)Web中的session指的是用户在浏览某个网站时,从进入网站到浏览器关闭所经过的这段时间,也就是用户浏览这个网 ...

  4. 【Foreign】字串变化 [DP]

    字串变化 Time Limit: 10 Sec  Memory Limit: 128 MB Description 定义一个(大写字母)字符串集合{S},初始时值包含一个给定的字符串S1,每次从中任意 ...

  5. loj516 「LibreOJ β Round #2」DP 一般看规律

    传送门:https://loj.ac/problem/516 [题解] 那段代码求的是相同的数中间隔最小的值. 离散后用set维护每个值出现次数,每次操作相当于合并两个set,这步可以启发式合并. 加 ...

  6. Python 语言使用中遇到的问题汇总

    1.python中的传值和传引用 和其他语言不一样,传递参数的时候,python不允许程序员选择采用传值还是传引用.Python参数传递采用的肯定是“传对象引用”的方式.实际上,这种方式相当于传值和传 ...

  7. hdu 1869 六度分离(最短路floyd)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1869 六度分离 Time Limit: 5000/1000 MS (Java/Others)    M ...

  8. 空间数据库系列一:geomesa&sparksql 分析环境搭建

    geomesa sparksql 分析环境搭建 1.安装hbase-1.3.2.1 standlone版本,作为geomesa的store a.修改配置文件:hbase-1.3.2.1/conf/hb ...

  9. Android控件——ToggleButton多状态按钮(实现灯泡的开关)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxoAAAFxCAIAAAB7jkm1AAAgAElEQVR4nOy9eXgUVb7/Dy7j3BnH8T

  10. 【NOIP2016】组合数问题

    写着玩玩…… 反正超级sb题. #include<bits/stdc++.h> typedef long long ll; using namespace std; ll c[][],h[ ...