結果
| 問題 | 
                            No.2352 Sharpened Knife in Fall
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-06-17 01:44:04 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 520 ms / 3,000 ms | 
| コード長 | 835 bytes | 
| コンパイル時間 | 3,438 ms | 
| コンパイル使用メモリ | 243,984 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-24 19:29:15 | 
| 合計ジャッジ時間 | 16,268 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#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);
    double c = R * R * PI / 2.0 / (K + 1);
    for (int i = 1; i <= K; i++) {
        double x = c * (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';
    }
}