結果
| 問題 |
No.68 よくある棒を切る問題 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-07 21:36:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 513 ms / 5,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 1,050 ms |
| コンパイル使用メモリ | 80,872 KB |
| 実行使用メモリ | 9,424 KB |
| 最終ジャッジ日時 | 2024-12-26 10:05:34 |
| 合計ジャッジ時間 | 15,071 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
// 面白い
#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;
}