• BestCoder Round #35


    A

    题意:给出n个黑球,m个白球,每次取1个球,取了n+m次以后,会生成一个随机的01串S,

    如果第i次取出的是黑球,则s[i]=1,如果是白色的,那么s[i]=0, 问01串在S中出现的期望次数

     大概可以这样算,是因为取出一个01串之后,其他的有两个01串,三个01串,四个01串的情况都包含在里面,所以只需要算出一个01串的有多少种情况就可以了

     1 #include<iostream>  
     2 #include<cstdio>  
     3 #include<cstring> 
     4 #include <cmath> 
     5 #include<stack>
     6 #include<vector>
     7 #include<map> 
     8 #include<set>
     9 #include<queue> 
    10 #include<algorithm>  
    11 #define mod=1e9+7;
    12 using namespace std;
    13 
    14 typedef long long LL;
    15 
    16 LL jiecheng(int a){
    17     LL ans=1;
    18     for(int i=1;i<=a;i++)
    19     ans*=i;
    20     return ans;
    21 }
    22 
    23 LL gcd(LL a,LL b){
    24     return b==0? a:gcd(b,a%b);
    25 }
    26 
    27 int main(){
    28     int n,m,i;
    29     while(scanf("%d %d",&n,&m)!=EOF){
    30         int a=(n*m);
    31         int b=n+m;
    32         int xx=gcd(a,b);
    33         a=a/xx;
    34         b=b/xx;
    35         printf("%d/%d
    ",a,b);
    36     }return 0;
    37 }
    View Code

    最开始的时候用next_permutation ,到 9 12就跑不出来了

    后来才知道要状态压缩= =

    B

    给出一张有向无环图,要求在最多删去k条边之后,求出字典序最大的拓扑排序

    不会= = 看题解说要用到线段树= =

    挖坑

  • 相关阅读:
    第 01 组 Alpha 事后诸葛亮
    第 01 组 Alpha 冲刺(4/4)
    第 01 组 Alpha 冲刺(3/4)
    第 01 组 Alpha 冲刺(2/4)
    第 01 组 Alpha 冲刺(1/4)
    学习日志-2021.11.08
    论文阅读-2021.11.06
    学习日志-2021.10.25
    学习日志-2021.10.24
    学习日志-2021.10.18
  • 原文地址:https://www.cnblogs.com/wuyuewoniu/p/4375562.html
Copyright © 2020-2023  润新知