結果

問題 No.67 よくある棒を切る問題 (1)
コンテスト
ユーザー bal4u
提出日時 2019-09-07 14:20:48
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 858 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 166 ms
コンパイル使用メモリ 39,904 KB
最終ジャッジ日時 2026-02-22 04:42:26
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yukicoder: No.67 よくある棒を切る問題 (1)
// bal4u 2019.9.7

#include <stdio.h>
#include <stdlib.h>

typedef long long ll;

//// 高速入力
#if 1
int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll inLL() {
	ll n = 0; int c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int L[200005];

int main()
{
	int i, loop, N; ll K, s; double l, r, m;

	N = in(); 
	s = 0; for (i = 0; i < N; i++) L[i] = in(), s += L[i];
	K = inLL();
	l = 0; r = (double)s/K+1;
	loop = 50; while (loop--) {
      m = (l + r) / 2.0;
	  s = 0; for (i = 0; i < N; i++) s += (ll)((L[i])/m);
	  if (s < K) r = m; else l = m;
    }
	printf("%.12lf\n", m);
	return 0;
}
0