結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー BantakoBantako
提出日時 2018-05-30 17:06:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 167,768 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 00:28:23
合計ジャッジ時間 4,909 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 31 ms
6,944 KB
testcase_03 AC 56 ms
6,948 KB
testcase_04 AC 75 ms
6,940 KB
testcase_05 AC 75 ms
6,940 KB
testcase_06 AC 76 ms
6,944 KB
testcase_07 AC 77 ms
6,940 KB
testcase_08 AC 77 ms
6,940 KB
testcase_09 AC 78 ms
6,944 KB
testcase_10 AC 68 ms
6,940 KB
testcase_11 AC 71 ms
6,944 KB
testcase_12 AC 65 ms
6,944 KB
testcase_13 AC 72 ms
6,940 KB
testcase_14 AC 74 ms
6,940 KB
testcase_15 AC 66 ms
6,944 KB
testcase_16 AC 75 ms
6,940 KB
testcase_17 AC 77 ms
6,944 KB
testcase_18 AC 76 ms
6,940 KB
testcase_19 AC 77 ms
6,940 KB
testcase_20 AC 78 ms
6,944 KB
testcase_21 AC 78 ms
6,940 KB
testcase_22 AC 69 ms
6,940 KB
testcase_23 AC 72 ms
6,944 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 14 ms
6,940 KB
testcase_29 AC 8 ms
6,944 KB
testcase_30 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
double INF = 1e9;
double EPS = 1e-9;
int MOD = 1e9+7;
vector<ll> V;
ll countup(double len){
    ll cnt = 0;
    for(auto i:V){
        cnt += (ll)floor(i / len);
    }
    return cnt;
}
main(){
   ll N,K;
   cin >> N;
   V.resize(N);
   rep(i,N)scanf("%lld",&V[i]);
   cin >> K;
   double ok = EPS,ng = INF;
   //while(fabs(ok - ng) > EPS){
    for(int i = 0;i < 100;i++){
       double mid = (ok + ng) / 2;
       if(countup(mid) >= K)ok = mid;
       else                 ng = mid;
       //cout << ok << endl;
   }
   printf("%.9lf\n",ok);
}
0