結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 古寺いろは古寺いろは
提出日時 2015-04-13 08:02:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 888 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 1,309 ms
コンパイル使用メモリ 152,924 KB
実行使用メモリ 70,328 KB
最終ジャッジ日時 2023-09-17 19:56:13
合計ジャッジ時間 18,111 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 870 ms
70,144 KB
testcase_01 AC 888 ms
69,828 KB
testcase_02 AC 888 ms
69,520 KB
testcase_03 AC 879 ms
70,288 KB
testcase_04 AC 887 ms
69,724 KB
testcase_05 AC 875 ms
69,860 KB
testcase_06 AC 875 ms
69,356 KB
testcase_07 AC 879 ms
69,480 KB
testcase_08 AC 866 ms
70,328 KB
testcase_09 AC 867 ms
69,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

vector<double> num;

int main(){
	int N;
	cin >> N;
	vector<int> L(N);
	for (int i = 0; i < N; i++)
	{
		cin >> L[i];
	}
	sort(L.begin(), L.end());
	reverse(L.begin(), L.end());

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j <= 500001 / (i + 1); j++)
		{
			num.push_back(L[i] / (j + 1.0));
		}
	}

	sort(num.begin(), num.end());
	reverse(num.begin(), num.end());

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++)
	{
		int K;
		cin >> K;
		printf("%.14f\n", num[K - 1]);
	}

}
0