結果

問題 No.2352 Sharpened Knife in Fall
ユーザー HIcoderHIcoder
提出日時 2023-07-05 14:26:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,449 bytes
コンパイル時間 1,152 ms
コンパイル使用メモリ 102,332 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-26 14:21:39
合計ジャッジ時間 7,081 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
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<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
const double PI=acos(-1);

double area(double r,double y){
    double theta=acos(y/r);

    return r*r*theta - y*sqrt(r*r-y*y);

}

int main(){
    int R,K;
    cin>>R>>K;

    int halfK=K/2;

    vector<double> ans;
    
    for(int k=1;k<=halfK;k++){
        double ub=R;
        double lb=0;
        
        double Sk=PI*R*R*k/(K+1);

        for(int x=0;x<100;x++){
            double mid=(ub+lb)/2;

            //cout<<"k="<<k<<endl;
            //cout<<"ub="<<ub<<endl;
            //cout<<"lb="<<lb<<endl;


            if(area(R,mid)<=Sk){
                ub=mid;
            }else{
                lb=mid;
            }

        }
        //cout<<"ub="<<ub<<endl;

        ans.push_back(ub);
    }

    int n=ans.size();

    if(K%2==1){
        for(int k=0;k<n;k++){
            printf("%.10f\n",ans[k]);
        }

        printf("%.10f\n",0);

        for(int k=n-1;k>=0;k--){
            printf("%.10f\n",-ans[k]);
        }
        
    }else{
        
        for(int k=0;k<n;k++){
            printf("%.10f\n",ans[k]);
        }

        for(int k=n-1;k>=0;k--){
            printf("%.10f\n",-ans[k]);
        }
        
    }


}
0