ZOJ 5579 Stean
2015-09-12 17:29
357 查看
SteanTime Limit: 1 Second Memory Limit: 65536 KB Special Judge
Tom is good at making stean, he can make steans of various color and shape. Now he want to know how many water it can contain, and how many material he need to making a stean.
View Code
Tom is good at making stean, he can make steans of various color and shape. Now he want to know how many water it can contain, and how many material he need to making a stean.
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); double FUCK(double z) { return PI*(4*z + 4*sin(z) + z/2 + sin(2*z)/4); } double f(double z) { double tmp = 2*PI*(2 + cos(z))*sqrt(1 + sin(z)*sin(z)); return tmp; } double simpson(double a,double b,int n = 10000) { const double h = (b - a)/n; double ans = f(a) + f(b); for(int i = 1; i < n; i += 2) ans += 4*f(a+i*h); for(int i = 2; i < n; i += 2) ans += 2*f(a+i*h); return ans*h/3; } int main() { double z1,z2; int kase; scanf("%d",&kase); while(kase--) { scanf("%lf%lf",&z1,&z2); double v = FUCK(z2) - FUCK(z1); double ss = PI*(2 + cos(z1))*(2 + cos(z1)); if(z1 > z2) swap(z1,z2); double s = simpson(z1,z2) + ss; printf("%.10f %.10f\n",v,s); } return 0; }
View Code
相关文章推荐
- JS+CSS简单树形菜单实现方法
- MongoDB学习笔记
- C++字符数组的输入输出和字符串结束标志使用讲解
- linux 编辑memcahed以及memcahed+php扩展遇到的问题
- 如何管理一个超过100人的研发团队?
- 关于custom adapter 中调用getview()次数的问题
- PHP中获取来访者IP的方法
- zoj1049
- mysql操作指南-----如何查看mysql 端口号
- tmp32dll\sha1-586.asm(1432) : error A2070:invalid instruction operands
- Windows 上使用Intellij DEAR14 搭建Spark14编程环境总结
- 判断值是否存在于数组中
- Myeclipse启动tomcat的debug模式,总是跳到Class.class里面的解决办法
- JavaFX8中去掉ScrollPane边框的3种方式
- 项目里有相同的文件名(在不同的文件夹里)
- URL与资源(之Url地址栏中的jsessionId有分号)《包括相对路径和绝对路径的根本分析》
- Android中SQLite应用详解
- ATI 4870 显卡在显示器休眠后再开花屏
- rman 脚本
- ios 类似android的toast