結果

問題 No.2352 Sharpened Knife in Fall
ユーザー nemutainemutai
提出日時 2023-06-16 22:46:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 374 ms / 3,000 ms
コード長 1,070 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 171,496 KB
実行使用メモリ 4,888 KB
最終ジャッジ日時 2023-09-06 21:20:23
合計ジャッジ時間 13,727 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 223 ms
4,724 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 370 ms
4,656 KB
testcase_07 AC 185 ms
4,384 KB
testcase_08 AC 371 ms
4,656 KB
testcase_09 AC 374 ms
4,652 KB
testcase_10 AC 370 ms
4,596 KB
testcase_11 AC 317 ms
4,604 KB
testcase_12 AC 325 ms
4,888 KB
testcase_13 AC 327 ms
4,652 KB
testcase_14 AC 146 ms
4,388 KB
testcase_15 AC 298 ms
4,660 KB
testcase_16 AC 19 ms
4,384 KB
testcase_17 AC 9 ms
4,384 KB
testcase_18 AC 123 ms
4,384 KB
testcase_19 AC 250 ms
4,720 KB
testcase_20 AC 109 ms
4,384 KB
testcase_21 AC 101 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,ll>;
using vp=vector<pair<ll, ll>>;

const ll INF=1ll<<60;
ll mod10=1e9+7;
ll mod99=998244353;
const double PI = acos(-1);

#define rep(i,n) for (ll i=0;i<n;++i)
#define per(i,n) for(int i=n-1;i>=0;--i)
#define rep2(i,a,n) for (ll i=a;i<n;++i)
#define per2(i,a,n) for (ll i=a;i>=n;--i)

int main(){
    double R;
    ll N;
    cin>>R>>N;
    vector<double> ans;
    if(N%2)ans.push_back(0);
    double S=R*R*PI/(N+1);
    rep(i,N/2){
        double l=0,r=R+0.000001;
        double s=((N%2?1:0.5)+i)*S;
        while(r-l>1e-9){
            double m=(l+r)/2;
            double o=2*acos(m/R);
            double ss=0.5*(R*R)*sin(o)+0.5*R*R*(PI-o);
            if(ss<=s)l=m;
            else r=m;
        }
        ans.push_back(l);
        ans.push_back(-l);
    }
    sort(all(ans));
    for(auto x:ans){
        cout << fixed<<setprecision(10)<<x << endl;
    }
}
0