結果

問題 No.472 平均順位
コンテスト
ユーザー 👑 tails
提出日時 2016-12-22 00:15:02
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 343 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 352 ms
コンパイル使用メモリ 36,948 KB
最終ジャッジ日時 2026-02-23 23:55:07
ジャッジサーバー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:3: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |   ^
main.c:1:5: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |     ^
main.c:1:7: warning: data definition has no type or storage class
    1 | n;p;i;j;
      |       ^
main.c:2:1: warning: data definition has no type or storage class
    2 | a;b;c;
      | ^
main.c:2:3: warning: data definition has no type or storage class
    2 | a;b;c;
      |   ^
main.c:2:5: warning: data definition has no type or storage class
    2 | a;b;c;
      |     ^
main.c:3:1: warning: data definition has no type or storage class
    3 | e;
      | ^
main.c:5:1: warning: data definition has no type or storage class
    5 | d[15010];
      | ^
main.c: In function 'main':
main.c:10:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |         scanf("%d%d",&n,&p);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | n;p;i;j;
main.c:20:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   20 |         printf("%.8f",(double)d[p]/n);
      |         ^~~~~~
main.c:20:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #
raw source code

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