結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー cielciel
提出日時 2018-02-12 00:09:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 235 ms / 5,000 ms
コード長 490 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 57,600 KB
実行使用メモリ 9,316 KB
最終ジャッジ日時 2024-05-01 10:48:11
合計ジャッジ時間 9,660 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 235 ms
9,308 KB
testcase_01 AC 225 ms
9,316 KB
testcase_02 AC 235 ms
9,300 KB
testcase_03 AC 229 ms
9,312 KB
testcase_04 AC 228 ms
9,296 KB
testcase_05 AC 219 ms
9,204 KB
testcase_06 AC 234 ms
8,892 KB
testcase_07 AC 232 ms
8,968 KB
testcase_08 AC 220 ms
8,640 KB
testcase_09 AC 223 ms
8,936 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