結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー ikeyanabcd894ikeyanabcd894
提出日時 2019-05-06 10:43:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,393 ms / 5,000 ms
コード長 413 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 160,888 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:43:02
合計ジャッジ時間 34,192 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,393 ms
6,816 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 525 ms
6,940 KB
testcase_03 AC 1,001 ms
6,944 KB
testcase_04 AC 1,363 ms
6,940 KB
testcase_05 AC 1,361 ms
6,940 KB
testcase_06 AC 1,359 ms
6,944 KB
testcase_07 AC 1,382 ms
6,940 KB
testcase_08 AC 1,386 ms
6,940 KB
testcase_09 AC 1,385 ms
6,940 KB
testcase_10 AC 1,227 ms
6,944 KB
testcase_11 AC 1,295 ms
6,944 KB
testcase_12 AC 1,181 ms
6,944 KB
testcase_13 AC 1,265 ms
6,944 KB
testcase_14 AC 1,321 ms
6,940 KB
testcase_15 AC 1,177 ms
6,940 KB
testcase_16 AC 1,362 ms
6,940 KB
testcase_17 AC 1,363 ms
6,940 KB
testcase_18 AC 1,365 ms
6,940 KB
testcase_19 AC 1,384 ms
6,944 KB
testcase_20 AC 1,382 ms
6,940 KB
testcase_21 AC 1,388 ms
6,944 KB
testcase_22 AC 1,225 ms
6,940 KB
testcase_23 AC 1,295 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 30 ms
6,940 KB
testcase_26 AC 13 ms
6,944 KB
testcase_27 AC 9 ms
6,940 KB
testcase_28 AC 223 ms
6,944 KB
testcase_29 AC 112 ms
6,940 KB
testcase_30 AC 31 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N;
long long K;
vector<long long> L(200009);
double lb=0,ub=1000000000;

bool C(double x){
  long long sum=0;
  for(int i=0;i<N;i++)sum+=floor(L[i]/x);
  return sum>=K;
}

int main(){
  cin >> N;
  for(int i=0;i<N;i++)cin >> L[i];
  cin >> K;
  for(int i=0;i<1000;i++){
    double mid=(ub+lb)/2;
    if(C(mid)){lb=mid;}
    else ub=mid;
  }
  printf("%.12f",lb);
}
0