結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | masa |
提出日時 | 2015-02-15 02:19:16 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 62,748 KB |
実行使用メモリ | 9,160 KB |
最終ジャッジ日時 | 2023-09-06 01:13:11 |
合計ジャッジ時間 | 10,069 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 177 ms
4,572 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 68 ms
4,376 KB |
testcase_03 | AC | 129 ms
4,380 KB |
testcase_04 | AC | 158 ms
4,624 KB |
testcase_05 | AC | 158 ms
4,756 KB |
testcase_06 | AC | 158 ms
4,568 KB |
testcase_07 | AC | 177 ms
4,684 KB |
testcase_08 | AC | 178 ms
4,736 KB |
testcase_09 | AC | 177 ms
4,624 KB |
testcase_10 | AC | 142 ms
4,488 KB |
testcase_11 | AC | 149 ms
4,748 KB |
testcase_12 | AC | 136 ms
4,424 KB |
testcase_13 | AC | 162 ms
4,416 KB |
testcase_14 | AC | 168 ms
4,576 KB |
testcase_15 | AC | 151 ms
4,424 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:8: warning: ‘mid’ may be used uninitialized in this function [-Wmaybe-uninitialized] printf("%.10f\n", mid); ~~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> const double EPS = 1e-9; using namespace std; int main() { int n; long long k; cin >> n; vector<double> l(n, 0); for (int i = 0; i < n; i++) { cin >> l[i]; } cin >> k; double upper = 1e9; double lower = 0; double mid; long long count; while (upper - lower > EPS && upper / lower > EPS) { mid = (upper + lower) / 2; count = 0; for (int i = 0; i < n; i++) { count += l[i] / mid; } if (count >= k) { lower = mid; } else { upper = mid; } } printf("%.10f\n", mid); return 0; }