64bit IO Format: %lld

1 0 1

0.500

### 备注:

(（x+a)/2+b)/2=(x+a)/4+b/2

#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll N=1e5+5; int n;double x,a[N]; int main(){    scanf("%d%lf",&n,&x);    for(int i=1;i<=n;i++)        scanf("%lf",&a[i]);    sort(a+1,a+1+n);    for(int i=1;i<=n;i++)    {        double tmp=(x+a[i])/2.0;        if(tmp>x)        {            x=tmp;        }    }    printf("%.3lf",x);    return 0;}

## B： 出题人的女装

64bit IO Format: %lld

10 10 8 8 1

7/9

### 备注:

2<=n,m<=10000 2<=x<=n且2<=y<=m

#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#define ll long longusing namespace std;ll a[1000000];ll gcd(ll a,ll b) { return b == 0 ? a : gcd(b, a % b); }int main(){    ll n,m,x,y,t;    cin>>n>>m>>x>>y>>t;    if(t==0)    {        double a=x*(x-1)*m*(m-1)+y*(y-1)*n*(n-1);        double b=(n-1)*(m-1)*(x*m+n*y);        printf("%0.3lf\n",a*1.0/b);    }    else{       ll a=x*(x-1)*m*(m-1)+y*(y-1)*n*(n-1);        ll b=(n-1)*(m-1)*(x*m+n*y);                if(a==0){            cout<<"0/1";        }        else if(a==b){            cout<<"1/1";        }else{                        ll k=gcd(a,b);            a/=k;            b/=k;            cout<<a<<"/"<<b<<endl;        }    }    return 0;}

## D出题人的手环

64bit IO Format: %lld

4 1 3 2 3

24

## 备注:

n<=200000，-10^9<=珠子上的整数<=10^9。

#include<stdio.h>#include<string>#include<string.h>#include<cstdio>#include<algorithm>#include<iostream>using namespace std;typedef long long ll;const int mod=1000000007;const int MAXN=200000+5;//最大元素个数int n;//元素个数ll c[MAXN],a[MAXN];//c[i]==A[i]+A[i-1]+...+A[i-lowbit(i)+1]ll b[MAXN];//返回i的二进制最右边1的值int lowbit(int i){    return i&(-i);}//返回A[1]+...A[i]的和ll sum(int x){    ll sum = 0;    while(x){        sum += c[x];        x -= lowbit(x);    }    return sum;}//令A[i] += valvoid add(int x, ll val){        while(x <= n){        c[x] += val;        x += lowbit(x);    }}int num[MAXN];int main(){        while(scanf("%d",&n)!=-1)    {                memset(c,0,sizeof(c));        memset(num,0,sizeof(num));        for(int i=1;i<=n;i++)        {            scanf("%lld",&a[i]);            b[i]=a[i];        }           sort(b+1,b+n+1);        ll ans=0;        int sum1=1;        for(int i=n;i>0;i--)        {            int pos=lower_bound(b+1,b+n+1,a[i])-b;            num[pos]++;            ans=(ans+sum(pos-1))%mod;            add(pos,1);        }                ll sum=ans;         //cout<<ans<<endl;        for(int i=1;i<n;i++)        {            int pos=lower_bound(b+1,b+n+1,a[i])-b;            ans=(ans+(n-pos-num[pos]+1)-(pos-1)+mod)%mod;///不要忘了+mod            //cout<<a[i]<<" "<<n-pos-num[pos]+1<<" "<<pos-1<<endl;            //cout<<ans<<endl;            sum=(sum*ans)%mod;        }        cout<<sum<<endl;    }    return 0;}