結果

問題 No.2352 Sharpened Knife in Fall
ユーザー FplusFplusFFplusFplusF
提出日時 2023-06-16 21:55:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,089 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 202,116 KB
実行使用メモリ 5,528 KB
最終ジャッジ日時 2023-09-06 19:34:41
合計ジャッジ時間 6,869 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
ld r,k;
ld f(ld x){
    ld w=sqrtl(r*r-x*x)*2;
    ld t=w*abs(x)/(ld)2;
    ld a=acosl(x/r);
    return r*r*a-t;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> r >> k;
    ld sum=0;
    ld x=r*r*(ld)M_PI/(ld)(k+1);
    vector<ld> ans;
    rep(i,(ll)k/2){
        ld ok=r,ng=-r;
        while(0.0000001<abs(ok-ng)){
            ld mid=(ok+ng)/2;
            if(f(mid)-sum<=x) ok=mid;
            else ng=mid;
        }
        ans.push_back(ok);
        sum+=f(ok);
    }
    if((ll)k%2!=0) ans.push_back(0);
    rep(i,(ll)k/2){
        ans.push_back(-ans[(ll)k/2-1-i]);
    }
    reverse(all(ans));
    for(auto &i:ans) cout << fixed << setprecision(10) << i << '\n';
}
0