結果

問題 No.2352 Sharpened Knife in Fall
ユーザー hiro71687khiro71687k
提出日時 2023-06-16 22:54:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 802 ms / 3,000 ms
コード長 1,394 bytes
コンパイル時間 4,270 ms
コンパイル使用メモリ 264,812 KB
実行使用メモリ 5,496 KB
最終ジャッジ日時 2023-09-06 21:33:30
合計ジャッジ時間 23,149 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 535 ms
5,344 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 730 ms
5,384 KB
testcase_07 AC 387 ms
4,376 KB
testcase_08 AC 722 ms
5,496 KB
testcase_09 AC 719 ms
5,308 KB
testcase_10 AC 755 ms
5,332 KB
testcase_11 AC 802 ms
5,296 KB
testcase_12 AC 763 ms
5,320 KB
testcase_13 AC 802 ms
5,304 KB
testcase_14 AC 402 ms
4,384 KB
testcase_15 AC 778 ms
5,352 KB
testcase_16 AC 39 ms
4,384 KB
testcase_17 AC 18 ms
4,384 KB
testcase_18 AC 294 ms
4,384 KB
testcase_19 AC 565 ms
5,408 KB
testcase_20 AC 246 ms
4,384 KB
testcase_21 AC 220 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=20000000000000;
ll mod=998244353;
int main(){
    ld r;
    ll k;
    cin >> r >> k;
    ld s=pie*r*r/((ld)(k+1.0));
    ld now=0;
    vector<ld>ans;
    ld left=0,right=r;
    for (ll i = 0; i < k/2; i++)
    {
        if (i>=1)
        {
            right=ans[ans.size()-1];
        }
        left=0;
        while (right-left>0.0000000001)
        {
            ld mid=(right+left)/2.0;
            ld y=mid;
            ld x=sqrt(r*r-y*y);
            ld tt=atan(y/x);
            ld theta=pie-tt;
            if (theta>tt)
            {
                swap(theta,tt);
            }
            ld ss=pie*r*r;
            ss*=tt/(2.0*pie);
            ld sss=pie*r*r;
            sss*=theta/(2.0*pie);
            ss-=sss;
            ss-=y*x;
            ss-=now;
            if (ss<=s)
            {
                right=mid;
            }else{
                left=mid;
            }
        }
        now+=s;
        ans.push_back(left);
    }
    for (ll i = 0; i < k/2; i++)
    {
        ans.push_back(-ans[i]);
    }
    if (k%2)
    {
        ans.push_back(0);
    }
    sort(ans.begin(),ans.end());
    for (ll i = 0; i < ans.size(); i++)
    {
        cout << setprecision(100) << ans[i] << endl;
    }
    
}
0