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