题意

题目链接

Sol

看了status里面最短的代码。。感觉自己真是菜的一批。。直接爆搜居然可以过?。。但是现在还没终测所以可能会fst。。

#include<bits/stdc++.h>
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define int long long
#define LL long long
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
using namespace std;
const int MAXN = 1e6 + 10, mod = 1e9 + 7, INF = 1e9 + 10;
const double eps = 1e-9;
template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmax(A &a, B b){if(a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
template <typename A> inline void debug(A a){cout << a << '\n';}
template <typename A> inline LL sqr(A x){return 1ll * x * x;}
inline int read() {
char c = getchar(); int x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
int W, a[9], ans;
void dfs(int x, int now) {
if(x == 9) {chmax(ans, now);return ;}
for(int num = 9, v = min((W - now) / x, a[x]); num; num--, v--)
dfs(x + 1, now + max((int)0, v * x));
}
signed main() {
W = read();
for(int i = 1; i <= 8; i++) a[i] = read();
dfs(1, 0);
cout << ans;
return 0;
}

最新文章

  1. Equls 和==的区别
  2. web服务器软件集成包问题
  3. Linux踢出其他正在SSH登陆用户
  4. C语言之实现控制台光标随意移动
  5. 在ssh框架中注解方式需要注意的几个问题
  6. 51 nod 1495 中国好区间 奇葩卡时间题 700ms 卡O(n*log(n)), 思路:O(n)尺取法
  7. SQLServer中重建聚集索引之后会影响到非聚集索引的索引碎片吗
  8. 从VGA到GPU!细数二十年显卡发展历程
  9. SQL中关于Join、Inner Join、Left Join、Right Join、Full Join、On、 Where区别
  10. Fiddler的配置
  11. CF983A Finite or not?(数学)
  12. 论文总结(Frequent Itemsets Mining With Differential Privacy Over Large-Scale Data)
  13. mac下用命令行解压文件
  14. Luogu P1129 [ZJOI2007]矩阵游戏
  15. HDU 3635:Dragon Balls(并查集)
  16. 第二个spring冲刺第5天
  17. class 命名规范
  18. rapidxml的常见读写操作
  19. while循环for循环优缺点和应用
  20. 【BZOJ3624】【APIO2008】免费道路 [生成树][贪心]

热门文章

  1. Cannot load php5apache2_4.dll into server
  2. 初识KNN
  3. hbase之InitMetaProcedure流程
  4. 一文让你彻底理解 Java NIO 核心组件
  5. [CERC2014] Virus synthesis
  6. 冒泡 MS Azure 不便宜。。。
  7. java为什么用咖啡?
  8. SpringMVC学习(四)———— 数据回显与自定义异常处理器
  9. Squid实现正向代理及访问控制--技术流ken
  10. JavaScript 系列博客(五)