提出 #18335818


ソースコード 拡げる

#include<stdio.h>

double dp[101][101][101];
double f(int a,int b,int c){
	if(dp[a][b][c])return dp[a][b][c];
	if(a==100||b==100||c==100)return 0;
	double ans=0;
	ans+=(f(a+1,b,c)+1)*a/(a+b+c);
	ans+=(f(a,b+1,c)+1)*b/(a+b+c);
	ans+=(f(a,b,c+1)+1)*c/(a+b+c);
	dp[a][b][c]=ans;
	return ans;
}

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%.9f\n",f(a,b,c));
}

提出情報

提出日時
問題 D - increment of coins
ユーザ kyopro_friends
言語 C (GCC 9.2.1)
得点 400
コード長 390 Byte
結果 AC
実行時間 37 ms
メモリ 9700 KiB

コンパイルエラー

./Main.c: In function ‘main’:
./Main.c:17:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   17 |  scanf("%d%d%d",&a,&b,&c);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 4
AC × 24
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
hand_01.txt AC 36 ms 8872 KiB
hand_02.txt AC 17 ms 5224 KiB
hand_03.txt AC 31 ms 9600 KiB
hand_04.txt AC 1 ms 1712 KiB
hand_05.txt AC 2 ms 2132 KiB
random_01.txt AC 10 ms 3648 KiB
random_02.txt AC 4 ms 3128 KiB
random_03.txt AC 6 ms 4984 KiB
random_04.txt AC 12 ms 4132 KiB
random_05.txt AC 2 ms 2068 KiB
random_06.txt AC 16 ms 4368 KiB
random_07.txt AC 17 ms 5636 KiB
random_08.txt AC 20 ms 6020 KiB
random_09.txt AC 11 ms 3464 KiB
random_10.txt AC 8 ms 2712 KiB
random_11.txt AC 4 ms 3752 KiB
random_12.txt AC 5 ms 2304 KiB
random_13.txt AC 7 ms 3124 KiB
random_14.txt AC 5 ms 2492 KiB
random_15.txt AC 12 ms 5776 KiB
sample_01.txt AC 1 ms 1644 KiB
sample_02.txt AC 1 ms 1644 KiB
sample_03.txt AC 37 ms 9700 KiB
sample_04.txt AC 9 ms 5120 KiB