結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-12-07 21:49:59 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 518 ms / 5,000 ms | 
| コード長 | 606 bytes | 
| コンパイル時間 | 1,215 ms | 
| コンパイル使用メモリ | 80,836 KB | 
| 実行使用メモリ | 9,036 KB | 
| 最終ジャッジ日時 | 2024-12-26 10:32:38 | 
| 合計ジャッジ時間 | 12,436 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
// 面白い
#include<iostream>
#include<queue>
#include<iomanip>
using namespace std;
double pre[500001];
int main(){
    int n;
    cin >> n;
    priority_queue<pair<double,int>> pq;
    for(int i = 0; i < n; i++){
        int x;  cin>> x;
        pq.push({x, 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;
}
            
            
            
        