結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-09-16 03:41:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 616 ms |
| コンパイル使用メモリ | 62,976 KB |
| 実行使用メモリ | 8,608 KB |
| 最終ジャッジ日時 | 2025-03-03 10:36:27 |
| 合計ジャッジ時間 | 5,612 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
ll n, L[200010];
ll k;
bool hantei(double m){
ll sum = 0;
rep(i, n){
sum += floor((double)L[i] / m);
if(sum >= k) return true;
}
return false;
}
int main(void){
cin >> n;
rep(i, n) cin >> L[i];
cin >> k;
printf("k\n");
//2分探索
double r = 1e10 + 1, l = 0.0;
int cnt = 0;
while(r - l > 1e-10 && cnt < 100){
cnt++;
double mid = (l + r) / 2.0;
if(hantei(mid)){
l = mid;
}else{
r = mid;
}
}
printf("%.10f\n", l);
return 0;
}
srup٩(๑`н´๑)۶