結果
| 問題 |
No.1319 最強とんがりコーン
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-12-16 13:43:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,059 ms / 2,000 ms |
| コード長 | 1,402 bytes |
| コンパイル時間 | 2,731 ms |
| コンパイル使用メモリ | 215,444 KB |
| 最終ジャッジ日時 | 2025-01-17 02:00:59 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 70 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(12);
double rmax, h, d;
cin >> rmax >> h >> d;
const double rmin = d / 2;
constexpr int num = 3e7;
const double rstep = (rmax - rmin) / num;
double ans = 0;
rep(i, num) {
//for(double r = rmin; r < rmax; r += rstep) {
const double r = rmin + rstep * i;
double t = acos(d / 2 / r);
//ans += r * r * (2 * t - sin(2 * t));
double x = 2 * t;
double x2 = x * x;
double z = 1;
for(int i = 20; i >= 4; i -= 2) {
z = 1 - x2 / (i * (i + 1)) * z;
}
z = r * r * x * x2 / 6 * z;
//ans += r * r * (x2 * x / 6 * (1 - x2 / 20 * (1 - x2 / 42 * (1 - x2 / 72 * (1 - x2 / 110 * (1 - x2 / 156))))));
ans += z;
}
ans *= rstep * h / rmax;
cout << ans << endl;
}
Kude