zoukankan      html  css  js  c++  java
  • bzoj 2134

    水概率DP,ANS=sigma(min(a[i],a[i-1])/(a[i]*a[i-1]))

     1 #include<bits/stdc++.h>
     2 #define inc(i,l,r) for(int i=l;i<=r;i++)
     3 #define dec(i,l,r) for(int i=l;i>=r;i--)
     4 #define link(x) for(edge *j=h[x];j;j=j->next)
     5 #define mem(a) memset(a,0,sizeof(a))
     6 #define inf 1e9
     7 #define ll long long
     8 #define succ(x) (1<<x)
     9 #define lowbit(x) (x&(-x))
    10 #define NM 10000000+5
    11 using namespace std;
    12 int read(){
    13     int x=0,f=1;char ch=getchar();
    14     while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    15     while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    16     return x*f;
    17 }
    18 int n,A,B,C,a[NM];
    19 double s;
    20 int main(){
    21     freopen("data.in","r",stdin);
    22     scanf("%d%d%d%d%d",&n,&A,&B,&C,a+1);
    23     for (int i=2;i<=n;i++) a[i] = ((long long)a[i-1] * A + B) % 100000001;
    24     for (int i=1;i<=n;i++) a[i] = a[i] % C + 1;
    25     a[n+1]=a[1];
    26     inc(i,2,n+1)s+=(double)min(a[i],a[i-1])/a[i]/a[i-1];
    27     printf("%.3lf
    ",s);
    28     return 0;
    29 }
    View Code
  • 相关阅读:
    ORBSLAM2的资源
    工程思想
    Linux中PATH、 LIBRARY_PATH、 LD_LIBRARY_PATH和ROS_PACKAGE_PATH
    CMkeList文件编写
    SLAM资料
    windows下隐藏文件夹
    Ubuntu16装Flash
    知识管理
    学习纲领
    lsof详解
  • 原文地址:https://www.cnblogs.com/onlyRP/p/5297453.html
Copyright © 2011-2022 走看看