結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | Lay_ec |
提出日時 | 2014-11-17 00:08:19 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 570 ms |
コンパイル使用メモリ | 76,636 KB |
実行使用メモリ | 9,416 KB |
最終ジャッジ日時 | 2023-08-30 08:29:25 |
合計ジャッジ時間 | 8,819 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
4,696 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 65 ms
4,376 KB |
testcase_03 | AC | 125 ms
4,380 KB |
testcase_04 | AC | 151 ms
4,616 KB |
testcase_05 | AC | 151 ms
4,696 KB |
testcase_06 | AC | 151 ms
4,556 KB |
testcase_07 | AC | 172 ms
4,556 KB |
testcase_08 | AC | 172 ms
4,620 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
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:47:9: warning: ‘m’ may be used uninitialized in this function [-Wmaybe-uninitialized] printf("%.16f\n",m); ~~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <cctype> using namespace std; int main(){ long n,k; cin>>n; vector<long> L(n); for(long i=0;i<n;i++) cin>>L[i]; cin>>k; sort(L.begin(),L.end()); if(n>=k) cout<<L[n-k]; else{ double l=0,r=L[n-1],m; while((r-l)>1e-10){ long num=0; m=(l+r)/2.0; for(long i=0;i<n;i++) num+=floor(L[i]/m); // cout<<"m="<<m<<"->"<<num<<endl; if(num<k) r=m; else{ l=m; } } printf("%.16f\n",m); } return 0; }