結果
| 問題 | No.67 よくある棒を切る問題 (1) |
| コンテスト | |
| ユーザー |
Ysmr_Ry
|
| 提出日時 | 2014-11-17 16:26:40 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 495 bytes |
| 記録 | |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 27,648 KB |
| 実行使用メモリ | 8,612 KB |
| 最終ジャッジ日時 | 2025-03-03 10:11:33 |
| 合計ジャッジ時間 | 8,436 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf( "%d", &N );
| ~~~~~^~~~~~~~~~~~
main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf( "%d", L+i );
| ~~~~~^~~~~~~~~~~~~
main.cpp:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf( "%d", &K );
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<cstdio>
#define rep(i,a) for(int i=0;i<(a);++i)
const int MAX_N = 200000;
int N, K;
int L[MAX_N];
bool C( double x )
{
int cnt = 0;
rep( i, N )
cnt += int(L[i]/x);
return cnt >= K;
}
int main()
{
scanf( "%d", &N );
rep( i, N )
scanf( "%d", L+i );
scanf( "%d", &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;
}
Ysmr_Ry