結果

問題 No.472 平均順位
ユーザー tailstails
提出日時 2016-12-22 00:15:02
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 242 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 1,079 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-17 14:08:58
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n;p;i;j;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
main.c:1:3: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |   ^
main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘p’ [-Wimplicit-int]
main.c:1:5: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |     ^
main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
main.c:1:7: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |       ^
main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | a;b;c;
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
main.c:2:3: warning: data definition has no type or storage class
    2 | a;b;c;
      |   ^
main.c:2:3: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int]
main.c:2:5: warning: data definition has no type or storage class
    2 | a;b;c;
      |     ^
main.c:2:5: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
    3 | e;
      | ^
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘e’ [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | d[15010];
      | ^
main.c:5:1: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
main.c:7:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    7 | min(a,b){return a<b?a:b;}
      | ^~~
main.c: In function ‘min’:
main.c:7:1: warning: type of ‘a’ defaults to ‘int’ [-Wimplicit-int]
main.c:7:1: warning: type of ‘b’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:9:1: wa

ソースコード

diff #

n;p;i;j;
a;b;c;
e;

d[15010];

min(a,b){return a<b?a:b;}

main(){
	scanf("%d%d",&n,&p);
	for(i=0;i<n;++i){
		scanf("%d%d%d",&a,&b,&c);
		for(j=p;j>=0;j--){
			d[j]+=a;
			if(j>=1&&d[j]>d[j-1]+b)d[j]=d[j-1]+b;
			if(j>=2&&d[j]>d[j-2]+c)d[j]=d[j-2]+c;
			if(j>=3&&d[j]>d[j-3]+1)d[j]=d[j-3]+1;
		}
	}
	printf("%.8f",(double)d[p]/n);
	return 0;
}
0