結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-31 20:08:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 853 bytes |
| コンパイル時間 | 538 ms |
| コンパイル使用メモリ | 81,348 KB |
| 実行使用メモリ | 12,700 KB |
| 最終ジャッジ日時 | 2025-03-03 10:21:10 |
| 合計ジャッジ時間 | 13,261 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
36 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:38:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
38 | for(int i=0;i<n;i++) scanf("%d",&l[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:40:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%lld",&k);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000009
#define INF 10000000
#define LLINF 2000000000000000000LL
#define SIZE 10001
ll k;
int n,l[200000];
bool check(double p){
ll cc=0;
for(int i=0;i<n;i++)
cc+=(int)(l[i]/p);
return cc>=k;
}
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d",&l[i]);
scanf("%lld",&k);
double l=0,r=LLINF,mid;
while(r-l>1e-11){
mid = (l+r)/2;
if(check(mid)){
l = mid;
}else{
r = mid;
}
}
printf("%.10lf\n",mid);
return 0;
}
goodbaton