結果
問題 |
No.472 平均順位
|
ユーザー |
|
提出日時 | 2017-11-27 15:28:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 858 ms |
コンパイル使用メモリ | 64,880 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 11:01:10 |
合計ジャッジ時間 | 2,616 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:22: warning: format ‘%lf’ expects argument of type ‘double’, but argument 2 has type ‘ld’ {aka ‘long double’} [-Wformat=] 28 | printf("%.15lf\n", (ld)dp1[P] / (ld)N); | ~~~~~^ ~~~~~~~~~~~~~~~~~~ | | | | double ld {aka long double} | %.15Lf
ソースコード
#include <iostream> #include <map> #include <vector> #include <algorithm> #include <stdio.h> using namespace std; typedef long double ld; const int INF = 1 << 29; int N, P; int dp1[15500], dp2[15500]; int main(void) { cin >> N >> P; for (int p = 0; p <= P; ++p) dp1[p] = dp2[p] = INF; dp1[0] = 0; for (int n = 0; n < N; ++n) { int nums[4]; cin >> nums[0] >> nums[1] >> nums[2]; nums[3] = 1; for (int p = 0; p <= P; ++p) { if (dp1[p] == INF) continue; for (int i = 0; i < 4; ++i) { dp2[p + i] = min(dp2[p + i], dp1[p] + nums[i]); } } for (int i = 0; i <= P; ++i) { dp1[i] = dp2[i]; dp2[i] = INF; } } printf("%.15lf\n", (ld)dp1[P] / (ld)N); return 0; }