zoukankan      html  css  js  c++  java
  • Codeforces 869C The Intriguing Obsession

    题意:有三种颜色的岛屿各a,b,c座,你可以在上面建桥。联通的点必须满足以下条件:1.颜色不同。2.颜色相同且联通的两个点之间的最短路径为3

    其实之用考虑两种颜色的即可,状态转移方程也不难推出:F[i][j]=F[i-1][j]+j*F[i-1][j-1]。答案就是F[a][b]*F[a][c]*F[b][c]

    #include<bits/stdc++.h>
    using namespace std;
    #define MAXN 5000+10
    #define MODD 998244353
    typedef long long LL;
    int a,b,c;
    LL f[MAXN][MAXN];
    int main(){
        scanf("%d%d%d",&a,&b,&c);
        for(int i=0;i<=5000;i++)f[0][i]=1;
        for(int i=1;i<=5000;i++){
            f[i][0]=1;
            for(int j=1;j<=5000;j++){
                f[i][j]=f[i-1][j]+j*f[i-1][j-1];
                f[i][j]%=MODD;    
            }
        }
        LL ans=f[a][b]*f[b][c]%MODD*f[a][c]%MODD;
        printf("%I64d",ans);
        return 0;
    }
  • 相关阅读:
    正式班D25
    解决oracle用户锁定
    python学习第17天
    python学习第16天
    python学习第15天
    python学习第十四天
    python学习第13天
    Python基础
    python学习第12天
    python学习第11天
  • 原文地址:https://www.cnblogs.com/NINGLONG/p/7642389.html
Copyright © 2011-2022 走看看