結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー bal4ubal4u
提出日時 2019-09-07 14:20:48
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 31,744 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 00:46:54
合計ジャッジ時間 2,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 9 ms
6,940 KB
testcase_03 AC 17 ms
6,940 KB
testcase_04 AC 23 ms
6,940 KB
testcase_05 AC 23 ms
6,944 KB
testcase_06 AC 24 ms
6,944 KB
testcase_07 AC 24 ms
6,940 KB
testcase_08 AC 24 ms
6,944 KB
testcase_09 AC 24 ms
6,940 KB
testcase_10 AC 21 ms
6,944 KB
testcase_11 AC 23 ms
6,940 KB
testcase_12 AC 20 ms
6,940 KB
testcase_13 AC 22 ms
6,940 KB
testcase_14 AC 24 ms
6,944 KB
testcase_15 AC 20 ms
6,944 KB
testcase_16 AC 24 ms
6,944 KB
testcase_17 AC 23 ms
6,944 KB
testcase_18 AC 23 ms
6,940 KB
testcase_19 AC 23 ms
6,944 KB
testcase_20 AC 23 ms
6,940 KB
testcase_21 AC 23 ms
6,940 KB
testcase_22 AC 21 ms
6,944 KB
testcase_23 AC 22 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 4 ms
6,948 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 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