結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー ttakanottakano
提出日時 2017-12-05 11:04:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 229 ms / 5,000 ms
コード長 915 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 162,272 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:16:10
合計ジャッジ時間 7,494 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 222 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 86 ms
6,940 KB
testcase_03 AC 165 ms
6,940 KB
testcase_04 AC 205 ms
6,940 KB
testcase_05 AC 203 ms
6,940 KB
testcase_06 AC 201 ms
6,940 KB
testcase_07 AC 226 ms
6,940 KB
testcase_08 AC 229 ms
6,940 KB
testcase_09 AC 227 ms
6,944 KB
testcase_10 AC 183 ms
6,940 KB
testcase_11 AC 194 ms
6,940 KB
testcase_12 AC 177 ms
6,940 KB
testcase_13 AC 209 ms
6,944 KB
testcase_14 AC 215 ms
6,944 KB
testcase_15 AC 194 ms
6,940 KB
testcase_16 AC 204 ms
6,940 KB
testcase_17 AC 205 ms
6,940 KB
testcase_18 AC 204 ms
6,944 KB
testcase_19 AC 228 ms
6,940 KB
testcase_20 AC 227 ms
6,944 KB
testcase_21 AC 226 ms
6,940 KB
testcase_22 AC 187 ms
6,944 KB
testcase_23 AC 195 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 6 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 37 ms
6,940 KB
testcase_29 AC 19 ms
6,944 KB
testcase_30 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int n;
ll l[202020];
ll k;

int main(){
  cin>>n;
  ll big=0;
  REP(i,n){
    cin>>l[i];
    big=max(big,l[i]);
  }
  cin>>k;
  sort(l,l+n);
  double right=big;
  double left=0;
  double max_=0;
  REP(q,101){
    double mid=(left+right)/2;
    ll val=0;
    REP(i,n){
      val+=l[i]/mid;
    }
    //print(left<<" "<<right<<" "<<mid);///
    //print("val "<<val);///
    if(val<k){
      right=mid;
      //print("right");///
    }
    else if(val>=k){
      left=mid;
      //print("left");///
    }
  }
  printf("%.10f",left);
  print("");
}
0