当前位置:网站首页>22-07-14 personal training match 2 competition experience
22-07-14 personal training match 2 competition experience
2022-07-26 08:18:00 【Fanshui 682】
Most of the valley questions , except J and L Are segment trees and dp
Too lazy to paste the intranet address .

A,B: Water problem
C: Thinking greedy ( Can't think of , It feels a little abstract )
D: A binary prefix and variant , A little difficult
E:dfs
F: Complex simulation graphics
H: simulation
K: water
L: Line segment tree
J: A line of pressure dp But I'm not very good at solving problems ()
Catalog
D:PROSJEK

Sample Input
6 3
7 1 2 1 3 6
Sample Output
3.333333
This question is very good , Finally, a binary variant is achieved , I always feel that I only know the surface of the routine
check Time complexity O(n).
Ideas : Accuracy dichotomy + Take with ruler ( Average thinking )+ The prefix and
The essence is after two points , It becomes the problem of whether the average is known and satisfied , Just take it with a ruler , And originally it can't be made with a ruler ( I'd like to think twice , Chi take also wanted to , But we didn't think together doge)
#include <bits/stdc++.h>
//#define int long long
#define CIO std::ios::sync_with_stdio(false)
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define nep(i, r, l) for (int i = r; i >= l; i--)
#define pii pair<int,int>
using namespace std;
const int N=3e5+5;
const double eps=1e-3;
double d[N];
int a[N];
double p[N];
int n,k;
bool check(double x){
rep(i,1,n) p[i]=p[i-1]+a[i]-x;
double mi=0;
rep(i,k,n){
if (p[i]>=mi) return true;
mi=min(mi,p[i-k+1]);
}
return false;
}
void work(){
cin>>n>>k;
rep(i,1,n){
cin>>a[i];
}
double l=0,r=1000010,mid;
while (abs(l-r)>eps){
mid=1.0*(l+r)/2;
if (check(mid)==false){
r=mid;
}
else{
l=mid;
}
}
printf("%.6lf",mid);
}
signed main(){
CIO;
work();
return 0;
}This time, all the other topics are covered by this D masked ( In fact, I am too lazy to write , And understand DP Well )
边栏推荐
猜你喜欢

Burp Suite-第五章 如何使用Burp Target

The first ide overlord in the universe, replaced...

Let's talk about the three core issues of concurrent programming.

JSP implicit object -- scope

C # get the information of the selected file

Burp suite Chapter 7 how to use burp scanner

Burp Suite-第八章 如何使用Burp Intruder

Excel file parsing

Ten thousand words long article | deeply understand the architecture principle of openfeign

SPSS用KMeans、两阶段聚类、RFM模型在P2P网络金融研究借款人、出款人行为规律数据
随机推荐
Spotty music data client_ ID account
The difference between equals() and = =
This is a picture
JSP built-in object (implicit object)
宇宙第一 IDE 霸主,换人了。。。
2w字详解数据湖:概念、特征、架构与案例
Awk operation
分享高压超低噪声LDO测试结果(High Voltage Ultra-low Noise LDO)
Burp Suite - Chapter 2 burp suite proxy and browser settings
正则表达式作业
2022 7/5 exam summary
2022/7/12 exam summary
2022 / 7 / 16 exam summary
Matplotlib learning notes
2022/7/9 exam summary
C # get the information of the selected file
The difference between LinkedList and ArrayList
OSPF summary
Zroi easy sum (generating function, block, DP, combination, polynomial)
数组的介绍--Array