結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-05-24 18:52:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 685 ms / 5,000 ms
コード長 1,323 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 174,600 KB
実行使用メモリ 70,056 KB
最終ジャッジ日時 2023-10-19 20:19:10
合計ジャッジ時間 15,574 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 685 ms
70,056 KB
testcase_01 AC 668 ms
70,056 KB
testcase_02 AC 667 ms
70,056 KB
testcase_03 AC 662 ms
70,056 KB
testcase_04 AC 664 ms
70,056 KB
testcase_05 AC 667 ms
70,056 KB
testcase_06 AC 663 ms
69,980 KB
testcase_07 AC 666 ms
70,020 KB
testcase_08 AC 638 ms
69,952 KB
testcase_09 AC 648 ms
69,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/




int N, L[101010], Q;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> L[i];
    sort(L, L + N, greater<int>());
    
    vector<double> qu;
    rep(i, 0, N) rep(j, 0, 500000 / (i + 1)){
        qu.push_back(1.0 * L[i] / (j + 1));
    }

    sort(qu.begin(), qu.end(), greater<double>());

    cin >> Q;
    rep(q, 0, Q) {
        int k; cin >> k;
        printf("%.12f\n", qu[k - 1]);
    }
}
0