結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー Ysmr_RyYsmr_Ry
提出日時 2014-11-17 16:33:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 333 ms / 5,000 ms
コード長 527 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 23,680 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:11:44
合計ジャッジ時間 8,937 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 331 ms
6,816 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 125 ms
6,940 KB
testcase_03 AC 240 ms
6,940 KB
testcase_04 AC 328 ms
6,944 KB
testcase_05 AC 328 ms
6,944 KB
testcase_06 AC 329 ms
6,940 KB
testcase_07 AC 330 ms
6,940 KB
testcase_08 AC 330 ms
6,944 KB
testcase_09 AC 330 ms
6,940 KB
testcase_10 AC 296 ms
6,944 KB
testcase_11 AC 314 ms
6,940 KB
testcase_12 AC 286 ms
6,944 KB
testcase_13 AC 303 ms
6,944 KB
testcase_14 AC 315 ms
6,944 KB
testcase_15 AC 284 ms
6,940 KB
testcase_16 AC 330 ms
6,940 KB
testcase_17 AC 328 ms
6,944 KB
testcase_18 AC 331 ms
6,944 KB
testcase_19 AC 332 ms
6,940 KB
testcase_20 AC 332 ms
6,944 KB
testcase_21 AC 333 ms
6,940 KB
testcase_22 AC 297 ms
6,944 KB
testcase_23 AC 312 ms
6,940 KB
testcase_24 AC 0 ms
6,940 KB
testcase_25 AC 7 ms
6,944 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 53 ms
6,944 KB
testcase_29 AC 26 ms
6,944 KB
testcase_30 AC 7 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |         scanf( "%lld", &N );
      |         ~~~~~^~~~~~~~~~~~~~
main.cpp:26:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |                 scanf( "%lld", L+i );
      |                 ~~~~~^~~~~~~~~~~~~~~
main.cpp:27:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         scanf( "%lld", &K );
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include<cstdio>
#define rep(i,a) for(int i=0;i<(a);++i)

typedef long long ll;

const int MAX_N = 200000;

ll N;
ll L[MAX_N];
ll K;

bool C( double x )
{
	ll cnt = 0;

	rep( i, N )
		cnt += int(L[i]/x);

	return cnt >= K;
}

int main()
{
	scanf( "%lld", &N );
	rep( i, N )
		scanf( "%lld", L+i );
	scanf( "%lld", &K );

	double lb = 0, ub = 1e9;
	rep( i, 1000 )
	{
		double mid = (lb+ub)/2;

		if( C( mid ) )
			lb = mid;
		else
			ub = mid;
	}

	printf( "%.9f\n", lb );

	return 0;
}
0