摘要: 题目链接: 题意:给一个长度为n和m,k的数组,的最大值。 题解:考虑dp的做法,dp[i][j]代表以第i个数为右端点,长度减一求余m的值为j时的最大值。 转移方程:dp[i][j]=dp[i-1][j-1]+a[i](j>0) dp[i][j]=max(dp[i-1][m-1]+a[i]-k,a 阅读全文
posted @ 2019-07-23 17:53 tryatry 阅读(560) 评论(4) 推荐(0) 编辑
摘要: Description Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new probl 阅读全文
posted @ 2019-05-04 19:18 tryatry 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给出一个长度为N的非负整数序列Ai​,对于所有1 ≤ k ≤ (N + 1) / 2,输出A1, A3, …, A2k - 1的中位数。即前1,3,5,…个数的中位数。 输入输出格式 输入格式: 第1行为一个正整数N,表示了序列长度。 第2行包含N个非负整数Ai ​(Ai​≤109)。 输 阅读全文
posted @ 2019-05-03 14:36 tryatry 阅读(375) 评论(0) 推荐(0) 编辑
摘要: The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all pl 阅读全文
posted @ 2019-04-29 21:50 tryatry 阅读(330) 评论(0) 推荐(0) 编辑
摘要: You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number 阅读全文
posted @ 2019-04-25 17:26 tryatry 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/634/C来源:牛客网 题目描述 给出一个区间[L,R],求出[L,R]中孪生质数有多少对。 由于这是一个区间筛质数的模板题。所以小k不屑于去写。 所以出题人只好yy了另一道题。 定义k生互质数为满足y + k与y - k 阅读全文
posted @ 2019-04-24 11:50 tryatry 阅读(321) 评论(0) 推荐(0) 编辑
摘要: //线段树 延迟标签 // #include <bits/stdc++.h> using namespace std; const int maxn=1e4+5; double x[maxn*4]; double y[maxn*4]; int degreen[maxn]; int d[maxn*4] 阅读全文
posted @ 2019-04-21 22:23 tryatry 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/problem/17385来源:牛客网 题目描述 NIBGNAUK is an odd boy and his taste is strange as well. It seems to him that a positive integ 阅读全文
posted @ 2019-04-12 14:01 tryatry 阅读(295) 评论(0) 推荐(0) 编辑