結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー LayCurseLayCurse
提出日時 2014-11-13 01:49:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 940 bytes
コンパイル時間 1,304 ms
コンパイル使用メモリ 144,252 KB
実行使用メモリ 4,468 KB
最終ジャッジ日時 2023-08-08 05:30:12
合計ジャッジ時間 3,788 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 16 ms
4,380 KB
testcase_03 AC 28 ms
4,376 KB
testcase_04 AC 38 ms
4,456 KB
testcase_05 AC 38 ms
4,376 KB
testcase_06 AC 39 ms
4,380 KB
testcase_07 AC 37 ms
4,376 KB
testcase_08 AC 38 ms
4,384 KB
testcase_09 AC 38 ms
4,448 KB
testcase_10 AC 34 ms
4,376 KB
testcase_11 AC 37 ms
4,380 KB
testcase_12 AC 33 ms
4,376 KB
testcase_13 AC 34 ms
4,380 KB
testcase_14 AC 36 ms
4,376 KB
testcase_15 AC 33 ms
4,376 KB
testcase_16 AC 39 ms
4,380 KB
testcase_17 AC 40 ms
4,380 KB
testcase_18 AC 39 ms
4,380 KB
testcase_19 AC 38 ms
4,376 KB
testcase_20 AC 38 ms
4,376 KB
testcase_21 AC 37 ms
4,468 KB
testcase_22 AC 35 ms
4,424 KB
testcase_23 AC 36 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 8 ms
4,376 KB
testcase_29 AC 4 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

#define ll long long

void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}

int N;
int A[200000];
ll K;

int main(){
  int i, j, loop;
  double a, b, c;
  ll val;

  reader(&N);
  rep(i,N) reader(A+i);
  reader(&K);

  a = 0; b = 1e10;
  rep(loop,100){
    c = (a+b)/2;
    val = 0;
    rep(i,N) val += (ll)(A[i]/c);
    if(val >= K) a = c; else b = c;
  }

  printf("%.15f\n",(a+b)/2);

  return 0;
}
0