結果

問題 No.2352 Sharpened Knife in Fall
ユーザー tsugutsugu
提出日時 2023-06-17 01:42:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 508 ms / 3,000 ms
コード長 819 bytes
コンパイル時間 3,052 ms
コンパイル使用メモリ 244,208 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-24 19:27:49
合計ジャッジ時間 16,155 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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