hiho week 216 register

Ended

Participants:197

Verdict:Accepted
Score:100 / 100
Submitted:2018-08-19 10:47:25

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
int a[100005];
struct node
{
    double l;
    int num;
    double now;
    bool operator <(const node &bb)const{return now<bb.now;}
};
priority_queue <node> q;
int main()
{
    int n,m,k;
    scanf("%d%d%d",&m,&n,&k);
    a[0]=0;
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&a[i]);
        q.push(node{a[i]-a[i-1],1,a[i]-a[i-1]});
    }
    while(k--)
    {
        node tmp=q.top();
       // cout<<tmp.num<<endl;
        q.pop();
        tmp.num+=1;
        tmp.now=tmp.l/tmp.num;
        q.push(tmp);
    }
    printf("%.1f\n",q.top().now);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX