結果
問題 |
No.67 よくある棒を切る問題 (1)
|
ユーザー |
|
提出日時 | 2016-09-23 14:45:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 28,928 KB |
実行使用メモリ | 10,656 KB |
最終ジャッジ日時 | 2025-03-03 10:37:03 |
合計ジャッジ時間 | 7,376 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 6 TLE * 1 -- * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d", &L[i]); | ~~~~~^~~~~~~~~~~~~ main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &K); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h> int main() { int N, K; int L[200000]; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d", &L[i]); } scanf("%d", &K); double EPS = 0.0000000001; double high = 1000000000; double low = 0.0; double middle; int sum; while (high-low > EPS) { middle = (high+low)/2.0; sum = 0; for (int i = 0; i < N; i++) sum += (int)(L[i]/middle); if (sum >= K) low = middle; else high = middle; } printf("%.09f", high); return 0; }