結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー cielciel
提出日時 2014-11-17 17:30:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 241 ms / 5,000 ms
コード長 511 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 48,128 KB
実行使用メモリ 9,152 KB
最終ジャッジ日時 2023-08-30 20:26:59
合計ジャッジ時間 9,548 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
9,096 KB
testcase_01 AC 234 ms
9,152 KB
testcase_02 AC 236 ms
9,136 KB
testcase_03 AC 228 ms
9,124 KB
testcase_04 AC 230 ms
9,136 KB
testcase_05 AC 227 ms
9,072 KB
testcase_06 AC 232 ms
8,396 KB
testcase_07 AC 231 ms
8,796 KB
testcase_08 AC 219 ms
8,376 KB
testcase_09 AC 223 ms
8,752 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