結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー ttakanottakano
提出日時 2017-12-05 10:57:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 865 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 147,296 KB
実行使用メモリ 5,312 KB
最終ジャッジ日時 2023-08-19 03:19:49
合計ジャッジ時間 8,400 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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(k,101){
    double mid=(left+right)/2;
    ll val=0;
    REP(i,n){
      val+=l[i]/mid;
    }
    print(left<<" "<<right<<" "<<mid);///
    print(val);///
    if(val<k){right=mid;}
    else if(val>=k){
      left=mid;
      print("max "<<left);
    }
  }
  printf("%.10f",left);
  print("");
}
0