zcmimi's blog
avatar
zc
2019-12-21 19:47:00
  • 本文总阅读量
查看原题

点击跳转

其实下面给出的a数组没什么鸟用

列出方程:

E = \sum_{i=0}^{n-1} \frac 1n \times ( i+ flag \times E)

解方程: E = \sum_{i=0}^{n-1} \frac 1n \times ( i+ flag \times E) \\\\ E = \sum_{i=0}^{n-1} \frac in + (1 - \frac mn)E \\\\ \frac mnE = \frac {\frac 12n(n-1)}n \\\\ E = \frac {n(n-1)}{2m}

#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define ull unsigned long long
    #define db double
    #define sht short
    #define MB template <class T>il
    #define Fur(i,x,y) for(int i=x;i<=y;i++)
    #define Fdr(i,x,y) for(int i=x;i>=y;i--)
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define fcin ios::sync_with_stdio(false)
    #define l2(n) (int(log2(n)))
    #define inf 0x3f3f3f3f
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>y?x:y;}
    MB T MIN(T x,T y){return x<y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB void SWAP(T &x,T &y){T t=x;x=y;y=t;}
}using namespace ZDY;using namespace std;
int n,m;
int main(){
    scanf("%d%d",&n,&m);
    printf("%.6f\n",(double)n*(n-1)/2/m);
}
51nod 1765 谷歌的恐龙
comment评论
Search
search