結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-20 12:10:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 680 bytes |
| コンパイル時間 | 751 ms |
| コンパイル使用メモリ | 88,232 KB |
| 実行使用メモリ | 22,456 KB |
| 最終ジャッジ日時 | 2025-03-03 12:07:01 |
| 合計ジャッジ時間 | 13,639 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:17: warning: use of ‘ll’ length modifier with ‘f’ type character has either no effect or undefined behavior [-Wformat=]
34 | printf("%.15llf\n", ok);
| ^
ソースコード
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cassert>
#include <cmath>
#include <bitset>
using namespace std;
int main() {
int n;
cin >> n;
vector<double> l(n);
for (int i = 0; i < n; i++) cin >> l[i];
long long k;
cin >> k;
double ok = 1e-15;
double ng = 1e10;
while (ok+1e-13 < ng) {
double x = (ok+ng)/2.0;
long long cnt = 0;
for (int i = 0; i < n; i++) cnt += l[i]/x;
cout << "x = " << x << ", cnt = " << cnt << endl;
if (cnt >= k) ok = x;
else ng = x;
}
printf("%.15llf\n", ok);
}