原题地址

DP很简单,懒得压缩空间了,反正都能过

 #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std; #define MAX_N 100008 int T, N;
long long score[MAX_N];
long long sum[MAX_N];
long long best[MAX_N]; int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
cin >> T;
while (T--) {
cin >> N;
memset(sum, , sizeof(sum));
memset(best, , sizeof(best));
for (int i = ; i <= N; i++)
cin >> score[i];
for (int i = N; i >= ; i--)
sum[i] = score[i] + sum[i + ];
best[N] = sum[N];
best[N - ] = sum[N - ];
best[N - ] = sum[N - ];
for (int i = N - ; i >= ; i--)
for (int j = ; j <= ; j++)
best[i] = max(best[i], sum[i] - best[i + j]);
cout << best[] << endl;
}
return ;
}

最新文章

  1. User interface
  2. 20款最佳用户体验的Sublime Text 2/3主题下载及安装方法
  3. MS SQL 合并结果集并求和 分类: SQL Server 数据库 2015-02-13 10:59 92人阅读 评论(0) 收藏
  4. dolby逝世:纪念一下
  5. fragment (1)简单示例:定义,界面配置,fragment之间的跳转
  6. UITableViewStyleGrouped 模式下 headview 多出一块高度问题
  7. Determining IP information for eth0... failed; no link present. Check cable?
  8. BZOJ2442: [Usaco2011 Open]修剪草坪
  9. Cocos2d-x win7 + vs2010 配置图文详解(亲测)
  10. 干货分享:Neutron的PPT,帮助你理解Neutron的各种细节
  11. MYSQL动态查询拼接的表名的SQL脚本实现(MYSQL动态执行SQL脚本)
  12. 2.获取公开的漏洞信息-查询还有哪些系统补丁未堵住-查询exp
  13. PB测款方法 店铺运费模板 设置
  14. day 5,格式化输出,for,while, break,continue,列表
  15. (网页)textarea去掉回车换行
  16. January 24th, 2018 Week 04th Wednesday
  17. 全球最大的3D数据集公开了!标记好的10800张全景图
  18. H5之localStorage,sessionStorage
  19. time_base
  20. python 字符串编码 ,区别 utf-8 和utf-8-sig

热门文章

  1. 洛谷 P2947 [USACO09MAR]仰望Look Up
  2. Gym 100342E Minima (暴力,单调队列)
  3. CSAPP lab1 datalab-handout
  4. vue 数组更新 this.$set(this.dataList, data.index, data.data)
  5. NoSuchBeanDefinitionException: No qualifying bean of type &#39;com.bj186.ssm.mapper.EmployeeMapper&#39; available: expected at least 1 bean which qualifies as autowire candidate
  6. javase(11)_juc并发库
  7. JavaWeb项目中集成Swagger API文档
  8. 计算机/ARM 系统
  9. Python9-迭代器-生成器-day13
  10. Python9-集合-day7