結果

問題 No.2352 Sharpened Knife in Fall
ユーザー iomir
提出日時 2023-06-16 22:46:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 369 ms / 3,000 ms
コード長 1,070 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 173,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 15:40:09
合計ジャッジ時間 12,050 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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