Submission #18354165


Source Code Expand

 //
#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INF = 1000000007;
const ll MOD = 1000000007;

void solve_test()
{
    int a, b, c;
    cin >> a >> b >> c;

    double p[102][102][102];
    memset(p, 0, sizeof(p));
    p[a][b][c]=1;
    for(int i=a; i<100; i++)
    {
        for(int j=b; j<100; j++)
        {
            for(int k=c; k<100; k++)
            {
                double ip = double(i)/(i+j+k);
                double jp = double(j)/(i+j+k);
                double kp = double(k)/(i+j+k);

                p[i+1][j][k] += p[i][j][k] * ip;
                p[i][j+1][k] += p[i][j][k] * jp;
                p[i][j][k+1] += p[i][j][k] * kp;
            }
        }
    }
    double ans = 0;
    for(int i=0; i<=100; i++)
    {
        for(int j=0; j<=100; j++)
        {
            for(int k=0; k<=100; k++)
            {
                int ct = (i==100) + (j==100) + (k==100);
                if(ct == 1)
                {
                    ans += p[i][j][k] * (i+j+k-a-b-c);
                }
            }
        }
    }
    cout << setprecision(20) << ans;
}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tests;
    tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve_test();
    }
    return 0;
}

Submission Info

Submission Time
Task D - increment of coins
User mathforces
Language C++ (GCC 9.2.1)
Score 400
Code Size 1529 Byte
Status AC
Exec Time 23 ms
Memory 11964 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand_01.txt AC 23 ms 11860 KiB
hand_02.txt AC 13 ms 11940 KiB
hand_03.txt AC 15 ms 11944 KiB
hand_04.txt AC 12 ms 11932 KiB
hand_05.txt AC 15 ms 11928 KiB
random_01.txt AC 12 ms 11924 KiB
random_02.txt AC 18 ms 11920 KiB
random_03.txt AC 13 ms 11900 KiB
random_04.txt AC 16 ms 11932 KiB
random_05.txt AC 12 ms 11948 KiB
random_06.txt AC 20 ms 11948 KiB
random_07.txt AC 14 ms 11852 KiB
random_08.txt AC 15 ms 11944 KiB
random_09.txt AC 15 ms 11904 KiB
random_10.txt AC 9 ms 11940 KiB
random_11.txt AC 15 ms 11964 KiB
random_12.txt AC 17 ms 11936 KiB
random_13.txt AC 13 ms 11868 KiB
random_14.txt AC 17 ms 11872 KiB
random_15.txt AC 13 ms 11896 KiB
sample_01.txt AC 12 ms 11872 KiB
sample_02.txt AC 15 ms 11964 KiB
sample_03.txt AC 15 ms 11900 KiB
sample_04.txt AC 14 ms 11944 KiB