Teach Yourself Pottery
来源:互联网 发布:南京弘历软件 编辑:程序博客网 时间:2024/06/14 12:55
Gym - 100113E
给定圆台的一面的直径和法线长度,问最大体积
直接三分就好了。
#include <bits/stdc++.h>using namespace std;const double pi = acos(-1);double L, D, l, r, mid1, mid2, v1, v2, ans;double get(double x) { return sin(x)*(D*D*3+L*D*6*cos(x)+L*L*cos(x)*cos(x)*4)*pi*L/12.0;}int main() { freopen("frustum.in","r",stdin); freopen("frustum.out","w",stdout); scanf("%lf %lf", &L, &D); l = 0; r = pi/2.0; for (int T = 1; T <= 100000; T++) { mid1 = l+(r-l)/3.0; mid2 = l+(r-l)/3.0*2; v1 = get(mid1); v2 = get(mid2); if (v1 > v2) { ans = max(ans, v1); r = mid2; } else { ans = max(ans, v2); l = mid1; } } printf("%.10lf\n", ans);}
阅读全文
0 0
- Teach Yourself Pottery
- Teach Yourself VISUALLY Laptops
- Teach Yourself VISUALLY MacBook
- How to Teach Yourself Programming
- Teach Yourself Programming in Ten Years
- Teach Yourself Programming in Ten Years
- Sams Teach Yourself MySQL in 21 Days
- Teach Yourself Programming in Ten Years
- Teach Yourself Programming in Ten Years
- Teach Yourself Programming in Ten Years
- Teach Yourself Programming in Ten Years
- Teach Yourself Programming in Ten Years
- Teach Yourself ADO.NET in 21 Days
- Sams Teach Yourself CSS in 10 Minutes
- Sams teach yourself C# in 24 hours
- Sams Teach Yourself AJAX in 10 Minutes
- Sams Teach Yourself MySQL in 10 Minutes
- Sams Teach Yourself MySQL in 10 Minutes
- Paxos Made Simple【翻译】
- 缓存一致性和跨服务器查询的数据异构解决方案canal
- JAX-RS 如何传输 JSON 格式的数据 ?
- PHP多维数组指定某个键来排序
- 颜色透明度百分比对应8位颜色值
- Teach Yourself Pottery
- .net / C#程序读取MAC地址的几种方法
- 字符串拷贝
- SpringMVC + Spring + MyBatis 经典
- mysql 里面的isnull()和ifnull() is null 和 is not null
- 模板的继承
- [Python][Scrapy 框架] Python3 Scrapy的安装
- Service两种启动方式的区别
- Javaweb三大框架知识点