結果

問題 No.1319 最強とんがりコーン
ユーザー carrot46carrot46
提出日時 2020-12-16 11:22:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,856 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 173,600 KB
実行使用メモリ 275,084 KB
最終ジャッジ日時 2023-10-20 09:18:20
合計ジャッジ時間 8,203 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

long double r, h, d;
vector<long double> memo;
void calc(long double lb, long double ub){
    long double z = (ub + lb) / 2;
    if(ub - lb < 1e-7){
        memo.push_back((lb * lb * log(sqrt(1 - lb * lb) + 1) + ub * ub * log(sqrt(1 - ub * ub) + 1)) * (ub - lb) * 0.5);
    }else{
        calc(lb, z); calc(z, ub);
    }
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll R, D;
    cin>>r>>h>>d;
    R = (ll)(r * 100 + 0.5);
    H = (ll)(h * 100 + 0.5);
    D = (ll)(d * 100 + 0.5);
    if(D == 0 || D == R){
        cout<<(D == 0 ? acos((long double)-1.0) * r * r * h / 3.0 : 0)<<endl;
    }else{
        long double lb = (long double)D / (R * 2);
        calc(lb, 1);
        sort(ALL(memo));
        cout<<fixed<<setprecision(10)<<(- accumulate(ALL(memo), (long double)0.0) * 2.0 + acos(lb) - lb * sqrt(- lb * lb + 1.0)
        + (lb*lb*lb * (1.0 - log(lb) * 3.0) - 1.0) * 2.0 / 9) * R * R * H * (long double)1e-6<<endl;
    }
}
0