結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー motumotumotumotu
提出日時 2014-11-17 01:42:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 430 ms / 5,000 ms
コード長 1,602 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 81,372 KB
実行使用メモリ 9,884 KB
最終ジャッジ日時 2023-08-30 08:53:22
合計ジャッジ時間 11,251 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 423 ms
9,632 KB
testcase_01 AC 422 ms
9,884 KB
testcase_02 AC 424 ms
9,660 KB
testcase_03 AC 427 ms
9,564 KB
testcase_04 AC 430 ms
9,508 KB
testcase_05 AC 422 ms
9,524 KB
testcase_06 AC 413 ms
9,256 KB
testcase_07 AC 419 ms
9,380 KB
testcase_08 AC 416 ms
8,856 KB
testcase_09 AC 414 ms
9,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define CLEAR(d) memset((d), 0, (sizeof((d))))
#define ALL(c) (c).begin(), (c).end()
#define ABS(x) ((x < 0) ? -(x) : (x))
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define SIZE(a) ((int)((a).size()))
#define MAX3(a, b, c) (max(max((a), (b)), (c)))
#define MIN3(a, b, c) (min(min((a), (b)), (c)))
#define MOD 1000000007
#define EPS 1e-5
#define PI  (acos(-1))
#define INF 10000000
//===================================================
typedef pair<double, int> DIP;
typedef pair<double, DIP> DPP;
double ans[500001];
int main()
{
    int n, q, k;
    double l;
    priority_queue<DPP> que;
    cin >> n;
    REP(i, n) {
        cin >> l;
        que.push(DPP(l, DIP(l, 1)));
    }
    REP(i, 500000) {
        ans[i + 1] = que.top().first;
        double b_l = que.top().second.first;
        int d_n = que.top().second.second + 1;
        double n_l = b_l / d_n;
        que.push(DPP(n_l, DIP(b_l, d_n)));
        que.pop();
    }
    cin >> q;
    REP(i, q) {
        cin >> k;
        printf("%.10f\n", ans[k]);
    }
    return 0;
}
0