結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
|
提出日時 | 2023-02-20 12:17:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 690 bytes |
コンパイル時間 | 800 ms |
コンパイル使用メモリ | 87,224 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 12:07:10 |
合計ジャッジ時間 | 7,471 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 30 |
コンパイルメッセージ
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; for (int j = 0; j < 100; j++) { 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); }