2019 GDUT Rating Contest I : Problem B. Teamwork
题面:
B. Teamwork
1
15
7
9
2
5
10
题目描述:
题目分析:


1 #include <cstdio>
2 #include <cstring>
3 #include <iostream>
4 #include <cmath>
5 #include <algorithm>
6 using namespace std;
7 const int maxn = 1e4+5;
8 const int maxk = 1e3+5;
9 int n, k;
10 int a[maxn];
11 int dp[maxn];
12
13 void test(){
14 cout << endl;
15 for(int i = 1; i <= n; i++){
16 printf("dp[%d] = %d\n", i, dp[i]);
17 }
18 }
19
20 int main(){
21 scanf("%d%d", &n, &k);
22 for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
23
24
25 for(int i = 1; i <= n; i++){
26 int pre_max = 0;
27 for(int j = 1; j <= k; j++){
28 if(i >= j){
29 if(a[i-j+1] > pre_max) pre_max = a[i-j+1];
30 dp[i] = max(dp[i], dp[i-j]+pre_max*j);
31 }
32 }
33 }
34
35 //test();
36 printf("%d\n", dp[n]);
37 return 0;
38 }
2019 GDUT Rating Contest I : Problem B. Teamwork的更多相关文章
- 2019 GDUT Rating Contest II : Problem F. Teleportation
题面: Problem F. Teleportation Input file: standard input Output file: standard output Time limit: 15 se ...
- 2019 GDUT Rating Contest III : Problem D. Lemonade Line
题面: D. Lemonade Line Input file: standard input Output file: standard output Time limit: 1 second Memo ...
- 2019 GDUT Rating Contest I : Problem H. Mixing Milk
题面: H. Mixing Milk Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest I : Problem A. The Bucket List
题面: A. The Bucket List Input file: standard input Output file: standard output Time limit: 1 second Me ...
- 2019 GDUT Rating Contest I : Problem G. Back and Forth
题面: G. Back and Forth Input file: standard input Output file: standard output Time limit: 1 second Mem ...
- 2019 GDUT Rating Contest III : Problem E. Family Tree
题面: E. Family Tree Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest III : Problem C. Team Tic Tac Toe
题面: C. Team Tic Tac Toe Input file: standard input Output file: standard output Time limit: 1 second M ...
- 2019 GDUT Rating Contest III : Problem A. Out of Sorts
题面: 传送门 A. Out of Sorts Input file: standard input Output file: standard output Time limit: 1 second M ...
- 2019 GDUT Rating Contest II : Problem G. Snow Boots
题面: G. Snow Boots Input file: standard input Output file: standard output Time limit: 1 second Memory ...
随机推荐
- 在QT C++中调用 Python并将软件打包发布(裸机可运行)
为了提高工作效率,需要一个可以自动生成多份相关联的word文档免去繁琐复制粘贴工作的软件.最后选定使用QT C++做界面和主要逻辑程序设计,对word的操作使用python写好对应的函数,然后在QT中 ...
- woj1009 最短路 The Legend of Valiant Emigration
title: woj1009 最短路 The Legend of Valiant Emigration date: 2020-03-07 categories: acm tags: [acm,最短路, ...
- Python Web Framework All In One
Python Web Framework All In One Django and Flask are the top Python web frameworks so far. Django ht ...
- GitHub Ribbons : 谈网站的安全性-资源链接如何 预防/实现 爬虫的批量下载!
GitHub Ribbons : 谈网站的安全性-资源链接如何 预防/实现 爬虫的批量下载! 预防方法: 1. 使用随机数字符串,拼接URL! https://camo.githubuserconte ...
- Xcode 切换 iOS 模拟器的 Dark 模式
Xcode 切换 iOS 模拟器的 Dark 模式 SwiftUI // // ContentView.swift // MemorizeGame // // Created by 夏凌晨 on 20 ...
- npm & config settings
npm & config settings how to check npm config settings https://docs.npmjs.com/cli/config $ npm c ...
- betterscroll上拉加载
mounted(){ var that=this; setTimeout(()=>{ let scroll = new BScroll(document.getElementById('wrap ...
- Android Studio 3.3.1 向avd模拟器发送本地文件
"工具栏/View/Tool Windows/Device File Pxplorer" 选择模拟器在找到对应的文件夹upload即可
- 「NGK每日快讯」12.22日NGK第49期官方快讯!
- 「NGK每日快讯」12.17日NGK第44期官方快讯!