結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー たこしたこし
提出日時 2015-06-08 14:48:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,185 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 88,708 KB
実行使用メモリ 5,292 KB
最終ジャッジ日時 2023-09-20 19:50:25
合計ジャッジ時間 4,874 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
5,144 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 110 ms
5,080 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 131 ms
5,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 96 ms
4,996 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 111 ms
4,848 KB
testcase_16 AC 110 ms
5,232 KB
testcase_17 AC 110 ms
5,236 KB
testcase_18 AC 110 ms
5,196 KB
testcase_19 AC 130 ms
5,100 KB
testcase_20 AC 130 ms
5,092 KB
testcase_21 AC 130 ms
5,208 KB
testcase_22 AC 99 ms
4,928 KB
testcase_23 AC 105 ms
5,012 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF_MIN 100000000
#define INF 1145141919
#define INF_MAX 2147483647
#define LL_MAX 9223372036854775807
#define EPS 1e-10
#define PI acos(-1)
#define LL long long

using namespace std;

#define MAX_N 200001
int N;
double L[MAX_N];
int K;

bool check(double mid){

  int ret = 0;
  
  for(int i = 0; i < N; i++){
    ret += (int)(L[i] / mid);
  }

  if(ret >= K)
    return true;
  else
    return false;

}

int main(){

  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> L[i];
  }
  cin >> K;

  double ansL = 0.0, ansR = (1e+9) + 1.0;

  for(int i = 0; i < 100; i++){
    
    double mid = (ansR + ansL)/2.0;

    if(check(mid)){
      ansL = mid;
    }
    else{
      ansR = mid;
    }

  }

  printf("%.15f\n", ansL);

  return 0;

}
0