結果

問題 No.2352 Sharpened Knife in Fall
ユーザー srjywrdnprkt
提出日時 2023-06-16 21:53:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,370 bytes
コンパイル時間 1,158 ms
コンパイル使用メモリ 111,436 KB
最終ジャッジ日時 2025-02-14 05:18:00
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    long double R, pi=M_PI, S, T, U;
    int K;
    cin >> R >> K;
    S = pi*R*R / (long double) (K+1);
    vector<long double> v;

    long double l, r, c;

    if (K % 2 == 0){
        T = 0;
        for (int i=0; i<K/2; i++){
            l = 0, r = pi/2;
            for (int j=0; j<30; j++){
                c = (r+l)/2;
                U = c * R * R + R * R * sin(c) * cos(c) - T;
                if (U*2 <= S) l=c;
                else r=c;
            }
            v.push_back(R*sin(l));
            v.push_back(-R*sin(l));
            T = S;
        }
    }
    else{
        v.push_back(0);
        T = 0;
        for (int i=0; i<K/2; i++){
            l = 0, r = pi/2;
            for (int j=0; j<30; j++){
                c = (r+l)/2;
                U = c * R * R + R * R * sin(c) * cos(c) - T;
                if (U <= S) l=c;
                else r=c;
            }
            v.push_back(R*sin(l));
            v.push_back(-R*sin(l));
            T = S;
        }
    }

    sort(v.begin(), v.end());
    for (auto x : v) cout << setprecision(18) << x << endl;

    return 0;
}
0