結果

問題 No.1319 最強とんがりコーン
ユーザー hotman78hotman78
提出日時 2022-01-12 19:22:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 950 bytes
コンパイル時間 2,141 ms
コンパイル使用メモリ 207,152 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 10:35:11
合計ジャッジ時間 4,235 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 WA -
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 3 ms
6,944 KB
testcase_13 AC 3 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 3 ms
6,940 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,940 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 2 ms
6,944 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 WA -
testcase_46 AC 2 ms
6,944 KB
testcase_47 AC 2 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 AC 3 ms
6,944 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 2 ms
6,944 KB
testcase_55 AC 2 ms
6,944 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 2 ms
6,940 KB
testcase_62 AC 2 ms
6,944 KB
testcase_63 AC 2 ms
6,948 KB
testcase_64 AC 2 ms
6,940 KB
testcase_65 AC 3 ms
6,940 KB
testcase_66 AC 2 ms
6,940 KB
testcase_67 AC 2 ms
6,940 KB
testcase_68 AC 2 ms
6,940 KB
testcase_69 AC 2 ms
6,940 KB
testcase_70 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using D=long double;

template<typename F>
D romberg_integration(int m,D a,D b,F f){
    assert(m<=24);
    std::vector<std::vector<D>>data(m,vector<D>(m));
    std::vector<D>h(m);
    h[0]=b-a;
    data[0][0]=(f(a)+f(b))*(b-a)/2;
    for(int i=1;i<m;++i){
        h[i]=h[i-1]/2;
        data[0][i]=data[0][i-1]/2;
        for(int j=0;j<(1<<(i-1));++j){
            data[0][i]+=h[i]*f(a+(2*j+1)*h[i]);
        }
    }
    for(int i=0;i<m-1;++i){
        for(int j=0;j<m-i-1;++j){
            data[i+1][j]=data[i][j+1]+(data[i][j+1]-data[i][j])/(pow(h[j]/h[j+1+i],2)-1);
        }
    }
    return data[m-1][0];
}

int main(){
    cout<<fixed<<setprecision(15);
    D r,h,d;
    cin>>r>>h>>d;
    auto f=[&](D z)->D{
        D r2=r*(h-z)/h;
        D t=acos(d/2/r2);
        if(r2*r2-d*d/4<0)return 0;
        return r2*r2*t-d*sqrt(r2*r2-d*d/4)/2;
    };
    cout<<romberg_integration(12,0,h,f)*2<<endl;
}
0