首页 > 其他分享 >题解:[YNOI2019] 游戏

题解:[YNOI2019] 游戏

时间:2024-10-18 20:22:14浏览次数:6  
标签:YNOI2019 frac 游戏 题解 long times 擂台 getchar 擂主

Problem Link

[YNOI2019] 游戏

题外话

第一眼,由乃?不打不打。

第二眼,欸 noi 三个字母怎么是大写(才发现是云南省选)。

题意

题意简洁,不再赘述。

Solution

一眼看出概率 dp,但如何似乎没思路?开始公式做题:设置状态+推转移式。

\(Q1\):怎么设置状态?

首先,思考一个问题:第 \(k\) 个人该怎么“赢”呢?

我们称前4人的比赛为“擂台”,一场擂台只会有一个胜者,这位胜者被称为“擂主”,再称那第 \(k\) 位选手为勇者。

勇者要赢,首先要等待再等待,进入“擂台”,并且保持胜利直至连胜 \(m\) 场,期间若输了则要再继续进行上述操作直到连胜 \(m\) 场。

那么,勇者要赢,首先要进入擂台,那么在他进入擂台前,擂主不能连赢大于等于 \(m\) 场,所以有一维状态 \(j\),表示擂主连胜了 \(j\) 场。

其次,他要在擂台上连赢 \(m\) 场,若输了,就要到最后排队,这时候勇者的位置会发生变化,所以另一维状态 \(i\),表示勇者在第 \(i\) 的位置。

那么 dp 的状态设置就很明了了,\(f_{i,j}\) 表示勇者在第 \(i\) 的位置,擂主已连胜 \(j\) 场时赢的概率。

\(Q2\):怎么推转移式?

对于 \(i\) 的值分类讨论。

边界条件(连胜了 \(m\) 场)

\(f_{1,m} = 1\),其他都是 \(0\)。因为只有自己是擂主时才能赢。

自己是擂主(\(i = 1\))

\(f_{1, j} = \frac{1}{4} \times f_{1, j + 1} + \frac{3}{4} \times f_{n - 2, 1}\)。自己胜了就胜场 \(+1\);反之掉到 \(n-2\) 的位置,胜场变为 \(1\)。

入了擂台,但不是擂主(\(1 < i \le 4\))

\[ f_{i, j} = \begin{cases} \frac{1}{4} \times f_{1, 1} + \frac{1}{4} \times f_{n - 2, j + 1} + \frac{1}{4} \times f_{n - 1, 1} + \frac{1}{4} \times f_{n, 1} & i = 2 \\ \frac{1}{4} \times f_{1, 1} + \frac{1}{4} \times f_{n - 1, j + 1} + \frac{1}{4} \times f_{n - 1, 1} + \frac{1}{4} \times f_{n, 1} & i = 3 \\ \frac{1}{4} \times f_{1, 1} + \frac{1}{4} \times f_{n - 1, j + 1} + \frac{1}{2} \times f_{n, 1} & i = 4 \end{cases} \]

对于各个位置分开讨论。

在等待入擂台的队伍中(\(i > 4\))

\(f_{i, j} = \frac{1}{4} \times f_{i - 3, j + 1} + \frac{3}{4} \times f_{i - 3, 1}\)。只看当前擂主是否胜利。

收尾

dp 式子有依赖关系怎么办?

没事,\(n \times (m+1)\) 只有 \(100\) 的量级,\(O(n^3m^3)\) 可过。

所以高斯消元即可。复杂度 \(O(n^3m^3)\)(还有 \(O(n^2m + m^3)\) 做法但我不会,不做讲解)。

另外,本题还能打表。

Code

// 高斯消元
// written by Naught
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double lb;
#define Maxn 15
#define Maxm 105
#define fo(i, l, r) for (int i = l; i <= r; ++i)
#define fr(i, r, l) for (int i = l; i >= r; --i)
inline int read(int x=0, bool f=0, char c=getchar()) {for(;!isdigit(c);c=getchar()) f^=!(c^45);for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);return f?-x:x;}
inline ll lread(ll x=0, bool f=0, char c=getchar()) {for(;!isdigit(c);c=getchar()) f^=!(c^45);for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);return f?-x:x;}
inline void train() {ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);}

lb f[Maxn][Maxn][Maxn], a[Maxm][Maxm];

int pos_in_Matrix(int x, int y, int m) {return (x - 1) * (m + 1) + y;}

void gauss(int x)
{
    fo(i, 0, x - 1)
    {
        int row = i;
        fo(j, i, x - 1) if(fabs(a[row][i]) < fabs(a[j][i])) row = j;
        if(row != i) swap(a[row], a[i]);
        lb res = a[i][i];
        fo(j, 0, x) a[i][j] /= res;
        fo(j, i + 1, x - 1) 
        {
            res = a[j][i];
            fo(k, 0, x) a[j][k] -= a[i][k] * res;
        }
    }
    fr(i, 0, x - 1) fr(j, 0, i - 1) a[j][x] -= a[j][i] * a[i][x], a[j][i] = 0;
}

lb Solve(int n, int m, int k)
{
    int upper = n * (m + 1), p = 0;
    memset(a, 0, sizeof(a));
    a[p][pos_in_Matrix(1, m, m)] += 1, a[p][upper] += 1, ++p;
    fo(i, 2, n) a[p][pos_in_Matrix(i, m, m)] += 1, ++p;
    fo(j, 0, m-1) a[p][pos_in_Matrix(1, j, m)] += 1, a[p][pos_in_Matrix(1, j + 1, m)] -= 0.25, a[p][pos_in_Matrix(n - 2, 1, m)] -= 0.75, ++p;
    fo(j, 0, m-1) a[p][pos_in_Matrix(2, j, m)] += 1, a[p][pos_in_Matrix(1, 1, m)] -= 0.25, a[p][pos_in_Matrix(n - 2, j + 1, m)] -= 0.25, a[p][pos_in_Matrix(n - 1, 1, m)] -= 0.5, ++p;
    fo(j, 0, m-1) a[p][pos_in_Matrix(3, j, m)] += 1, a[p][pos_in_Matrix(1, 1, m)] -= 0.25, a[p][pos_in_Matrix(n - 1, j + 1, m)] -= 0.25, a[p][pos_in_Matrix(n - 1, 1, m)] -= 0.25, a[p][pos_in_Matrix(n, 1, m)] -= 0.25, ++p;
    fo(j, 0, m-1) a[p][pos_in_Matrix(4, j, m)] += 1, a[p][pos_in_Matrix(1, 1, m)] -= 0.25, a[p][pos_in_Matrix(n, j + 1, m)] -= 0.25, a[p][pos_in_Matrix(n, 1, m)] -= 0.5, ++p;
    fo(i, 5, n) fo(j, 0, m-1) a[p][pos_in_Matrix(i, j, m)] += 1, a[p][pos_in_Matrix(i - 3, j + 1, m)] -= 0.25, a[p][pos_in_Matrix(i - 3, 1, m)] -= 0.75, ++p;
	gauss(upper);
    return a[pos_in_Matrix(k, 0, m)][upper];
}

int main()
{
    int _ = read(), n = read(), m = read(), k = read();
    printf("%.6Lf", Solve(n, m, k));
	return 0;
}
// 打表
// written by Naught
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double lb;
#define Maxn 15
#define fo(i, l, r) for (ll i = l; i <= r; ++i)
#define fr(i, r, l) for (int i = l; i >= r; --i)
inline int read(int x=0, bool f=0, char c=getchar()) {for(;!isdigit(c);c=getchar()) f^=!(c^45);for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);return f?-x:x;}
inline ll lread(ll x=0, bool f=0, char c=getchar()) {for(;!isdigit(c);c=getchar()) f^=!(c^45);for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);return f?-x:x;}
inline void train() {ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);}

lb f[Maxn][Maxn][Maxn] = {

{
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.217626 ,0.214029 ,0.205036 ,0.190647 ,0.172662 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.204447 ,0.202897 ,0.200883 ,0.198404 ,0.193368 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.201020 ,0.200713 ,0.200250 ,0.199631 ,0.198388 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200258 ,0.200180 ,0.200063 ,0.199907 ,0.199593 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200064 ,0.200045 ,0.200016 ,0.199977 ,0.199898 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200016 ,0.200011 ,0.200004 ,0.199994 ,0.199975 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200004 ,0.200003 ,0.200001 ,0.199999 ,0.199994 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200001 ,0.200001 ,0.200000 ,0.200000 ,0.199998 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.200000 ,0.200000 ,0.200000 ,0.200000 ,0.200000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.196429 ,0.178571 ,0.169643 ,0.169643 ,0.142857 ,0.142857 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.172295 ,0.169859 ,0.168180 ,0.167258 ,0.162357 ,0.160051 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.168119 ,0.167476 ,0.167036 ,0.166797 ,0.165505 ,0.165066 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.167028 ,0.166865 ,0.166757 ,0.166703 ,0.166378 ,0.166270 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.166757 ,0.166716 ,0.166689 ,0.166676 ,0.166594 ,0.166567 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.166689 ,0.166679 ,0.166672 ,0.166669 ,0.166649 ,0.166642 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.166672 ,0.166670 ,0.166668 ,0.166667 ,0.166662 ,0.166660 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.166668 ,0.166667 ,0.166667 ,0.166667 ,0.166666 ,0.166665 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.166667 ,0.166667 ,0.166667 ,0.166667 ,0.166666 ,0.166666 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.153226 ,0.153226 ,0.153226 ,0.153226 ,0.129032 ,0.129032 ,0.129032 ,0.000000 ,0.000000 ,0.000000},
{0.145879 ,0.145879 ,0.145879 ,0.145879 ,0.138829 ,0.138829 ,0.138829 ,0.000000 ,0.000000 ,0.000000},
{0.143570 ,0.143570 ,0.143570 ,0.143570 ,0.141907 ,0.141907 ,0.141907 ,0.000000 ,0.000000 ,0.000000},
{0.143037 ,0.143037 ,0.143037 ,0.143037 ,0.142617 ,0.142617 ,0.142617 ,0.000000 ,0.000000 ,0.000000},
{0.142902 ,0.142902 ,0.142902 ,0.142902 ,0.142797 ,0.142797 ,0.142797 ,0.000000 ,0.000000 ,0.000000},
{0.142868 ,0.142868 ,0.142868 ,0.142868 ,0.142842 ,0.142842 ,0.142842 ,0.000000 ,0.000000 ,0.000000},
{0.142860 ,0.142860 ,0.142860 ,0.142860 ,0.142853 ,0.142853 ,0.142853 ,0.000000 ,0.000000 ,0.000000},
{0.142858 ,0.142858 ,0.142858 ,0.142858 ,0.142856 ,0.142856 ,0.142856 ,0.000000 ,0.000000 ,0.000000},
{0.142857 ,0.142857 ,0.142857 ,0.142857 ,0.142857 ,0.142857 ,0.142857 ,0.000000 ,0.000000 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.144964 ,0.143412 ,0.138496 ,0.130217 ,0.121421 ,0.117282 ,0.113142 ,0.091066 ,0.000000 ,0.000000},
{0.130480 ,0.129798 ,0.128514 ,0.126629 ,0.123567 ,0.122343 ,0.120837 ,0.117833 ,0.000000 ,0.000000},
{0.126337 ,0.126133 ,0.125840 ,0.125455 ,0.124681 ,0.124396 ,0.123965 ,0.123193 ,0.000000 ,0.000000},
{0.125334 ,0.125284 ,0.125210 ,0.125113 ,0.124917 ,0.124844 ,0.124747 ,0.124551 ,0.000000 ,0.000000},
{0.125083 ,0.125071 ,0.125053 ,0.125028 ,0.124979 ,0.124961 ,0.124937 ,0.124888 ,0.000000 ,0.000000},
{0.125021 ,0.125018 ,0.125013 ,0.125007 ,0.124995 ,0.124990 ,0.124984 ,0.124972 ,0.000000 ,0.000000},
{0.125005 ,0.125004 ,0.125003 ,0.125002 ,0.124999 ,0.124998 ,0.124996 ,0.124993 ,0.000000 ,0.000000},
{0.125001 ,0.125001 ,0.125001 ,0.125000 ,0.125000 ,0.124999 ,0.124999 ,0.124998 ,0.000000 ,0.000000},
{0.125000 ,0.125000 ,0.125000 ,0.125000 ,0.125000 ,0.125000 ,0.125000 ,0.125000 ,0.000000 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.138514 ,0.128378 ,0.123311 ,0.123311 ,0.108108 ,0.108108 ,0.108108 ,0.081081 ,0.081081 ,0.000000},
{0.118047 ,0.115746 ,0.114416 ,0.114059 ,0.110159 ,0.109253 ,0.108938 ,0.105053 ,0.104328 ,0.000000},
{0.112697 ,0.112275 ,0.111989 ,0.111841 ,0.110993 ,0.110662 ,0.110514 ,0.109668 ,0.109361 ,0.000000},
{0.111508 ,0.111400 ,0.111328 ,0.111291 ,0.111075 ,0.111003 ,0.110967 ,0.110751 ,0.110676 ,0.000000},
{0.111211 ,0.111184 ,0.111165 ,0.111156 ,0.111102 ,0.111084 ,0.111075 ,0.111021 ,0.111003 ,0.000000},
{0.111136 ,0.111129 ,0.111125 ,0.111122 ,0.111109 ,0.111104 ,0.111102 ,0.111089 ,0.111084 ,0.000000},
{0.111117 ,0.111116 ,0.111115 ,0.111114 ,0.111111 ,0.111109 ,0.111109 ,0.111105 ,0.111104 ,0.000000},
{0.111113 ,0.111112 ,0.111112 ,0.111112 ,0.111111 ,0.111111 ,0.111111 ,0.111110 ,0.111109 ,0.000000},
{0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.111111 ,0.000000}
},

{
{0.250000 ,0.250000 ,0.250000 ,0.250000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000},
{0.116242 ,0.116242 ,0.116242 ,0.116242 ,0.101911 ,0.101911 ,0.101911 ,0.076433 ,0.076433 ,0.076433},
{0.104134 ,0.104134 ,0.104134 ,0.104134 ,0.099471 ,0.099471 ,0.099471 ,0.095017 ,0.095017 ,0.095017},
{0.101070 ,0.101070 ,0.101070 ,0.101070 ,0.099872 ,0.099872 ,0.099872 ,0.098701 ,0.098701 ,0.098701},
{0.100264 ,0.100264 ,0.100264 ,0.100264 ,0.099972 ,0.099972 ,0.099972 ,0.099677 ,0.099677 ,0.099677},
{0.100066 ,0.100066 ,0.100066 ,0.100066 ,0.099993 ,0.099993 ,0.099993 ,0.099919 ,0.099919 ,0.099919},
{0.100016 ,0.100016 ,0.100016 ,0.100016 ,0.099998 ,0.099998 ,0.099998 ,0.099980 ,0.099980 ,0.099980},
{0.100004 ,0.100004 ,0.100004 ,0.100004 ,0.100000 ,0.100000 ,0.100000 ,0.099995 ,0.099995 ,0.099995},
{0.100001 ,0.100001 ,0.100001 ,0.100001 ,0.100000 ,0.100000 ,0.100000 ,0.099999 ,0.099999 ,0.099999},
{0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000 ,0.000000}
}

};


int main()
{
    int _ = read(), n = read()-1, m = read()-1, k = read()-1;
    printf("%.6Lf", f[n][m][k]);
	return 0;
}

标签:YNOI2019,frac,游戏,题解,long,times,擂台,getchar,擂主
From: https://www.cnblogs.com/naughty-naught/p/18474990

相关文章

  • 异常问题解决
    异常:java程序编译或运行过程中出现的问题Throwable:Error:表示非常严重的问题,自己无法解决的问题Exception:除了RuntimeException其它异常【编译时期异常】:一般指的是异常尚未处理就编译了RuntimeException【运行时期异......
  • PTA L1系列题解(C语言)(L1_081 -- L1_088)
    L1-081今天我要赢题目内容:2018年我们曾经出过一题,是输出“2018我们要赢”。今年是2022年,你要输出的句子变成了“我要赢!就在今天!”然后以比赛当天的日期落款。输入格式:本题没有输入。输出格式:输出分2行。在第一行中输出I'mgonnawin!Today!,在第二行中用年年年......
  • 想玩Steam游戏,但配置太低?ToDesk云电脑一招搞定!
    在游戏爱好者的世界里,汇集了许多游戏大作的Steam平台无疑是一座宝库。但对于许多玩家来说,拥有一颗渴望畅玩游戏的心,却常常被低配置的电脑设备所束缚。尤其是面对硬件要求极高的3A大作时,低配置的电脑往往力不从心,卡顿、掉帧等问题让人苦恼不已。但别担心!小编最近发现ToDesk的云电......
  • 认知觉醒,精神控制陷阱:帮你识别并破解亲密关系中的权利游戏
    01什么是精神控制精神控制一词最早出现于20世纪70年代的美国。指通过操纵、控制他人的精神,对情感、认知与行为施加持续性的影响和控制,逐步改变脑部神经系统条件反射,使心理活动与行为活动发生异变,让他人服从操控者的意愿。精神控制实质是通过剥夺感知和强迫思维的手段,阻碍......
  • 《地狱已满2》游戏报错lpk.dll文件丢失怎么办?玩家必看《地狱已满2》遭遇lpk.dll丢失故
    对于热爱《地狱已满2》这款游戏的玩家来说,遇到“lpk.dll文件丢失”的报错信息无疑是一个巨大的困扰。这个错误通常意味着你的系统中缺失或损坏了lpk.dll这个动态链接库(DLL)文件,它是Windows系统的一部分,用于支持某些音频和多媒体功能。游戏运行时可能依赖这个文件,缺乏它会导致游......
  • P1955 程序自动分析 题解
    P1955程序自动分析一道并查集的裸题,并查集存储传递性,后判断。主题思路十分简单,重点在于离散化与离线的处理。离散化,为什么会想到离散化呢,观察数据范围\(1<i,j<{10}^9\),数据范围过大,导致数组不可能开到\(1e9\)但是\(1<n<1e5\)考虑到每次输入只有两个数,若每个数都两两不同,......
  • 【题解】[Codechef] Beautiful Permutation
    传送门以此纪念我场切的dp。这种计数的类型一看就很dp的样子。考场上一开始设的dp状态是\(dp_{i,j,k_1,k_2,0/1}\)表示将前\(i\)个数分为\(j\)段,放了\(k_1\)个偶数,\(k_2\)个奇数,当前段为偶数段或奇数段的方案数。考虑如何转移,记\(cnt_0\)表示序列中可填入的偶数......
  • Codeforces Round 892 (Div. 2)题解记录
    题目链接:https://codeforces.com/contest/1859A.UnitedWeStand选最大的数即可注意题目输出格式 #include<iostream> #include<string.h> #include<map> #include<vector> #include<set> #include<unordered_set> #include<stack> #incl......
  • Unity 华为快游戏JS桥接 实现写日志等功能
    之前接入微信小游戏本身代码js桥接比较完善,抖音小游戏有缺少但也没缺的这么多,华为这边的API,大残啊!官方转换插件Github仓库上一次提交在3月份。(截至现在)API给的很简略,接入js代码那里说看demo,但unity的demo里面没jslib,另一个比较完善的demo看起来像是cocos的,比较无奈。还好用unity......
  • 九宫格自由流转拼图游戏
    作者:狼哥团队:坚果派团队介绍:坚果派由坚果等人创建,团队拥有12个华为HDE带领热爱HarmonyOS/OpenHarmony的开发者,以及若干其他领域的三十余位万粉博主运营。专注于分享HarmonyOS/OpenHarmony、ArkUI-X、元服务、仓颉。团队成员聚集在北京,上海,南京,深圳,广州,宁夏等地,目前已开发鸿蒙原......