結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー shop_oneshop_one
提出日時 2019-08-06 18:50:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 234 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 65,956 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:44:36
合計ジャッジ時間 6,833 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 89 ms
6,944 KB
testcase_03 AC 168 ms
6,944 KB
testcase_04 AC 211 ms
6,940 KB
testcase_05 AC 211 ms
6,944 KB
testcase_06 AC 212 ms
6,940 KB
testcase_07 AC 234 ms
6,940 KB
testcase_08 AC 234 ms
6,940 KB
testcase_09 AC 234 ms
6,944 KB
testcase_10 AC 194 ms
6,940 KB
testcase_11 AC 201 ms
6,944 KB
testcase_12 AC 184 ms
6,944 KB
testcase_13 AC 213 ms
6,940 KB
testcase_14 AC 223 ms
6,944 KB
testcase_15 AC 199 ms
6,944 KB
testcase_16 AC 211 ms
6,944 KB
testcase_17 AC 211 ms
6,940 KB
testcase_18 AC 207 ms
6,940 KB
testcase_19 AC 234 ms
6,940 KB
testcase_20 AC 225 ms
6,944 KB
testcase_21 AC 201 ms
6,940 KB
testcase_22 AC 177 ms
6,944 KB
testcase_23 AC 178 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 6 ms
6,940 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 39 ms
6,940 KB
testcase_29 AC 21 ms
6,944 KB
testcase_30 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;
  ll sum;
  double s=0,e=10000000000,ans,si;
  cin >> n;
  double l[n];
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  cin >> k;
  for(int i=0;i<100;i++){
    si = (e+s)/2.0;
    sum=0;
    for(int j=0;j<n;j++){
      sum += (l[j])/si;
      if(sum>=k) break;
    }
    if(sum>=k){
      s = si;
    }else{
      e = si;
    }
  }
  ans = (e+s)/2;
  printf("%.15lf\n",ans);
}
0