結果

問題 No.2352 Sharpened Knife in Fall
ユーザー tsugutsugutsugutsugu
提出日時 2023-06-17 01:42:48
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 525 ms / 3,000 ms
コード長 819 bytes
コンパイル時間 2,734 ms
コンパイル使用メモリ 242,896 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 00:51:25
合計ジャッジ時間 16,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 438 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 522 ms
4,380 KB
testcase_07 AC 263 ms
4,376 KB
testcase_08 AC 523 ms
4,376 KB
testcase_09 AC 521 ms
4,380 KB
testcase_10 AC 525 ms
4,380 KB
testcase_11 AC 523 ms
4,384 KB
testcase_12 AC 522 ms
4,380 KB
testcase_13 AC 522 ms
4,380 KB
testcase_14 AC 246 ms
4,380 KB
testcase_15 AC 492 ms
4,384 KB
testcase_16 AC 27 ms
4,384 KB
testcase_17 AC 13 ms
4,384 KB
testcase_18 AC 189 ms
4,384 KB
testcase_19 AC 410 ms
4,380 KB
testcase_20 AC 162 ms
4,384 KB
testcase_21 AC 154 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif

const double PI = acos(-1);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double R, K;
    cin >> R >> K;
    auto f = [&] (double x) -> double {
        return (x * sqrt(R * R - x * x) + R * R * asin(x / R)) / 2.0;
    };
    double fr = f(-R);
    for (int i = 1; i <= K; i++) {
        double x = (R * R * PI) / 2.0 / (K + 1) * (double) i;
        double left = -R, right = R;
        int cnt = 100;
        while (cnt--) {
            double mid = (left + right) / 2;
            if (f(mid) - fr <= x) {
                left = mid;
            } else{
                right = mid;
            }
        }
        cout << fixed << setprecision(15) << left << '\n';
    }
}
0