結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-12-16 12:44:33 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 148 ms / 5,000 ms | 
| コード長 | 353 bytes | 
| コンパイル時間 | 1,587 ms | 
| コンパイル使用メモリ | 159,180 KB | 
| 実行使用メモリ | 8,608 KB | 
| 最終ジャッジ日時 | 2025-03-03 11:02:01 | 
| 合計ジャッジ時間 | 6,085 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n;scanf("%d",&n);
      |               ~~~~~^~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         rep(i,n)scanf("%d",&L[i]);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:10:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         ll k;scanf("%lld",&k);
      |              ~~~~~^~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int L[200000];
int main(){
	int n;scanf("%d",&n);
	rep(i,n)scanf("%d",&L[i]);
	ll k;scanf("%lld",&k);
	double l=0,r=1e9;
	rep(i,100){
		double t=(l+r)/2;
		ll cnt=0;
		rep(j,n)cnt+=L[j]/t;
		if(cnt>=k)l=t;
		else r=t;
	}
	printf("%.12lf\n",l);
}
            
            
            
        