結果

問題 No.463 魔法使いのすごろく🎲
ユーザー tailstails
提出日時 2016-12-14 00:40:56
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-07 10:08:26
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
5,248 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 11 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 12 ms
5,376 KB
testcase_05 AC 11 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 34 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 65 ms
5,376 KB
testcase_12 AC 35 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 54 ms
5,376 KB
testcase_15 AC 79 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 93 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 8 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 147 ms
5,376 KB
testcase_22 AC 305 ms
5,376 KB
testcase_23 AC 292 ms
5,376 KB
testcase_24 AC 10 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 182 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 0 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | main(n,m,h,i,j,k){
      | ^~~~
main.c: In function ‘main’:
main.c:3:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘m’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘h’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘j’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘k’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    5 |         scanf("%d%d",&n,&m);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | double c[110],e0[110],e1[110];
main.c:5:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    5 |         scanf("%d%d",&n,&m);
      |         ^~~~~
main.c:5:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:29:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   29 |         printf("%.10f\n",e0[1]);
      |         ^~~~~~
main.c:29:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:29:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:29:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

double c[110],e0[110],e1[110];

main(n,m,h,i,j,k){

	scanf("%d%d",&n,&m);
	for(i=2;i<n;++i){
		scanf("%lf",&c[i]);
	}

	for(h=0;h<10000;++h){
		for(i=n;--i;){
			e0[i]=0;
			e1[i]=0;
			for(j=i+1;j<=i+m;++j){
				k=j<n?j:n*2-j;
				e0[i]+=e0[k]+c[k];
				e1[i]+=e1[k]+c[k];
			}
			e0[i]/=m;
			e1[i]/=m;
			for(j=i+1;j<=i+m;++j){
				k=j<n?j:n*2-j;
				if(e0[i]>e1[k]+c[k]){
					e0[i]=e1[k]+c[k];
				}
			}
		}
	}
	printf("%.10f\n",e0[1]);
	return 0;
}
0