結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー cielciel
提出日時 2018-02-12 00:09:28
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 234 ms / 5,000 ms
コード長 490 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 79,712 KB
実行使用メモリ 9,084 KB
最終ジャッジ日時 2023-08-20 10:11:19
合計ジャッジ時間 10,564 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
8,996 KB
testcase_01 AC 234 ms
8,996 KB
testcase_02 AC 233 ms
9,080 KB
testcase_03 AC 225 ms
8,988 KB
testcase_04 AC 226 ms
9,084 KB
testcase_05 AC 225 ms
8,992 KB
testcase_06 AC 227 ms
8,588 KB
testcase_07 AC 230 ms
8,932 KB
testcase_08 AC 220 ms
8,620 KB
testcase_09 AC 221 ms
8,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <queue>
#include <cstdio>
#define M 500000
using namespace std;
int main(){
	int n;
	long long k;
	scanf("%d",&n);
	std::vector<double>v(n);
	priority_queue<pair<double,int> >pq;
	for(int i=0;i<n;i++){
		scanf("%lf",&v[i]);
		pq.push(make_pair(v[i],1));
	}
	vector<double>K(M+1);
	for(int i=1;i<=M;i++){
		auto e=pq.top();pq.pop();
		K[i]=e.first;
		pq.push(make_pair(e.first*e.second/(e.second+1),e.second+1));
	}
	for(scanf("%d",&n);n--;)scanf("%lld",&k),printf("%.9f\n",K[k]);
}
0