Submission #18316058


Source Code Expand

#include "bits/stdc++.h"
using namespace std;

const int N=1e2+20;

int a,b,c;
double dp[N][N][N];

double f(int a,int b,int c)
{
	double &ans=dp[a][b][c];
	if(ans!=0) return ans;

	if(a==100 or b==100 or c==100) return ans=0;
	ans+=1.*(f(a+1,b,c)+1)*a/(a+b+c);
	ans+=1.*(f(a,b+1,c)+1)*b/(a+b+c);
	ans+=1.*(f(a,b,c+1)+1)*c/(a+b+c);
	return ans;
}

int main()
{
	cin>>a>>b>>c;

	cout<<fixed<<setprecision(10);
	cout<<f(a,b,c);
}

Submission Info

Submission Time
Task D - increment of coins
User dush1729
Language C++ (GCC 9.2.1)
Score 400
Code Size 453 Byte
Status AC
Exec Time 40 ms
Memory 13532 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 37 ms 12640 KiB
hand_02.txt AC 21 ms 7988 KiB
hand_03.txt AC 36 ms 13428 KiB
hand_04.txt AC 2 ms 3760 KiB
hand_05.txt AC 4 ms 4304 KiB
random_01.txt AC 10 ms 5900 KiB
random_02.txt AC 6 ms 5364 KiB
random_03.txt AC 10 ms 7684 KiB
random_04.txt AC 15 ms 6696 KiB
random_05.txt AC 8 ms 4188 KiB
random_06.txt AC 14 ms 6996 KiB
random_07.txt AC 15 ms 8568 KiB
random_08.txt AC 23 ms 8868 KiB
random_09.txt AC 8 ms 5780 KiB
random_10.txt AC 7 ms 4980 KiB
random_11.txt AC 7 ms 6136 KiB
random_12.txt AC 5 ms 4528 KiB
random_13.txt AC 11 ms 5236 KiB
random_14.txt AC 11 ms 4792 KiB
random_15.txt AC 13 ms 8724 KiB
sample_01.txt AC 3 ms 3800 KiB
sample_02.txt AC 2 ms 3592 KiB
sample_03.txt AC 40 ms 13532 KiB
sample_04.txt AC 16 ms 7976 KiB