結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2015-07-31 20:12:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 60 ms / 5,000 ms |
コード長 | 864 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 79,800 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 10:21:13 |
合計ジャッジ時間 | 3,309 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:36:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:38:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | for(int i=0;i<n;i++) scanf("%d",&l[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:40:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 40 | scanf("%lld",&k); | ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <cstring> typedef long long ll; using namespace std; #define mod 1000000009 #define INF 10000000 #define LLINF 2000000000000000000LL #define SIZE 10001 ll k; int n,l[200000]; bool check(double p){ ll cc=0; for(int i=0;i<n;i++) cc+=(int)(l[i]/p); return cc>=k; } int main(){ scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&l[i]); scanf("%lld",&k); double l=0,r=1000000000,mid; for(int i=0;i<100;i++){ mid = (l+r)/2; if(check(mid)){ l = mid; }else{ r = mid; } } printf("%.10lf\n",mid); return 0; }