結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  Ysmr_Ry | 
| 提出日時 | 2014-11-17 16:33:15 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 337 ms / 5,000 ms | 
| コード長 | 527 bytes | 
| コンパイル時間 | 313 ms | 
| コンパイル使用メモリ | 27,776 KB | 
| 実行使用メモリ | 8,608 KB | 
| 最終ジャッジ日時 | 2025-03-03 10:11:47 | 
| 合計ジャッジ時間 | 9,049 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
コンパイルメッセージ
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 );
      |         ~~~~~^~~~~~~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        