結果

問題 No.2352 Sharpened Knife in Fall
ユーザー FplusFplusFFplusFplusF
提出日時 2023-06-16 22:13:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 703 ms / 3,000 ms
コード長 1,041 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 203,504 KB
実行使用メモリ 5,404 KB
最終ジャッジ日時 2023-09-06 20:13:48
合計ジャッジ時間 16,315 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 501 ms
5,228 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 694 ms
5,296 KB
testcase_07 AC 347 ms
4,388 KB
testcase_08 AC 703 ms
5,404 KB
testcase_09 AC 696 ms
5,244 KB
testcase_10 AC 701 ms
5,320 KB
testcase_11 AC 691 ms
5,304 KB
testcase_12 AC 687 ms
5,324 KB
testcase_13 AC 700 ms
5,248 KB
testcase_14 AC 313 ms
4,376 KB
testcase_15 AC 633 ms
5,244 KB
testcase_16 AC 35 ms
4,376 KB
testcase_17 AC 17 ms
4,376 KB
testcase_18 AC 241 ms
4,376 KB
testcase_19 AC 541 ms
5,316 KB
testcase_20 AC 226 ms
4,380 KB
testcase_21 AC 211 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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)*(ld)2;
    ld t=w*abs(x)/(ld)2;
    ld a=acosl(abs(x)/r);
    if(x<=0) return r*r*(ld)M_PI-(ld)(r*r*a-t);
    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){
        ld ok=r,ng=-r;
        while(0.0000000000001<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);
    }
    sort(all(ans));
    for(auto &i:ans) cout << fixed << setprecision(10) << i << '\n';
}
0