結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー | face4 |
提出日時 | 2019-12-07 21:36:28 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 429 ms / 5,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 892 ms |
コンパイル使用メモリ | 80,104 KB |
実行使用メモリ | 9,188 KB |
最終ジャッジ日時 | 2023-08-27 03:13:46 |
合計ジャッジ時間 | 13,991 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 427 ms
9,188 KB |
testcase_01 | AC | 416 ms
9,064 KB |
testcase_02 | AC | 422 ms
9,008 KB |
testcase_03 | AC | 415 ms
9,176 KB |
testcase_04 | AC | 429 ms
9,012 KB |
testcase_05 | AC | 419 ms
9,128 KB |
testcase_06 | AC | 413 ms
8,600 KB |
testcase_07 | AC | 414 ms
8,924 KB |
testcase_08 | AC | 407 ms
8,536 KB |
testcase_09 | AC | 405 ms
8,948 KB |
ソースコード
// 面白い #include<iostream> #include<queue> #include<iomanip> using namespace std; double pre[500001]; int main(){ int n; cin >> n; int l[n]; priority_queue<pair<double,int>> pq; for(int i = 0; i < n; i++){ cin >> l[i]; pq.push({l[i], 1}); } for(int i = 1; i <= 500000; i++){ pair<double,int> p = pq.top(); pq.pop(); pre[i] = p.first; pq.push({p.first*p.second/(p.second+1), p.second+1}); } int q; cin >> q; while(q--){ int k; cin >> k; cout << fixed << setprecision(12) << pre[k] << endl; } return 0; }