結果

問題 No.2352 Sharpened Knife in Fall
ユーザー momoyuumomoyuu
提出日時 2023-07-12 14:43:43
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,006 ms / 3,000 ms
コード長 1,362 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 140,600 KB
実行使用メモリ 4,772 KB
最終ジャッジ日時 2023-10-12 05:01:06
合計ジャッジ時間 25,629 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,356 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 860 ms
4,612 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1,005 ms
4,508 KB
testcase_07 AC 504 ms
4,376 KB
testcase_08 AC 1,005 ms
4,424 KB
testcase_09 AC 1,003 ms
4,504 KB
testcase_10 AC 1,006 ms
4,556 KB
testcase_11 AC 997 ms
4,556 KB
testcase_12 AC 1,004 ms
4,552 KB
testcase_13 AC 996 ms
4,772 KB
testcase_14 AC 472 ms
4,376 KB
testcase_15 AC 943 ms
4,388 KB
testcase_16 AC 50 ms
4,380 KB
testcase_17 AC 24 ms
4,376 KB
testcase_18 AC 363 ms
4,380 KB
testcase_19 AC 786 ms
4,384 KB
testcase_20 AC 309 ms
4,380 KB
testcase_21 AC 294 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<map>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
using ll = long long;


double calc(double r,double l){
    double x = sqrt(r*r-l*l);
    double y = l;
    double theta = atan2(y,x);
    theta = acos(-1)/2 - theta;
   
    double now =  r* r;
    now *=theta;

    now -= x * l;

    return now;

}

int main(){
    ll r,k;
    cin>>r>>k;
    vector<double> ans;
    double all = acos(-1) * r * r;
    double want = all / (double)(k+1);
    double use = 0;
    double last = r;
    //cout<<calc(r,0)<<" "<<want<<endl;
    //cout<<calc(r,0.264)<<endl;
    for(int i = 0;i<k;i++){
        double right = last;
        double left = -r;
        int q = 100;
        while(q--){
            double mid = (right+left)/2.;
            double now = 0;
            now += calc(r,abs(mid));
            if(mid>=0) now = now - use;
            else now = all - use - now;
            if(now>want) left = mid;
            else right = mid;
        }
       // cout<<right<<endl;
        ans.push_back(right);
        last = right;
        use += want;
    }
    cout<<fixed<<setprecision(30);
    sort(ans.begin(),ans.end());
    for(int i = 0;i<ans.size();i++) cout<<ans[i]<<endl;
}
0