結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 沙耶花
提出日時 2021-10-21 22:25:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 421 ms / 5,000 ms
コード長 717 bytes
コンパイル時間 4,474 ms
コンパイル使用メモリ 256,208 KB
最終ジャッジ日時 2025-01-25 02:42:18
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:42:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   42 |                 scanf("%d",&K);
      |                 ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000

int main(){
	
	int N;
	cin>>N;
	
	vector<long long> L(N);
	rep(i,N)cin>>L[i];
	
	priority_queue<pair<double,int>> Q;
	rep(i,N){
		Q.emplace(L[i],1);
	}
	
	vector<double> ans(500005,0);
	double m = 1e10;
	for(int i=1;i<ans.size();i++){
		auto p = Q.top();
		Q.pop();
		m = min(m,p.first);
		p.first *= p.second;
		p.second++;
		p.first /= p.second;
		Q.push(p);
		ans[i] = m;
	}
	
	
	int _q;
	cin>>_q;
	
	rep(_,_q){
		int K;
		scanf("%d",&K);
		cout<<fixed<<setprecision(10)<<ans[K]<<endl;
	}
	
	return 0;
}
0