HDU 1071 The area ——微积分
2024-08-25 16:44:30
【题目分析】
求二次函数和一次函数围成的面积。
先解方程求出一次函数和二次函数。
然后积分。
现在还是不会积分。
【代码】
#include <cstdio>
#include <cstring>
#include <cstdlib>
//#include <cmath> #include <set>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <iostream>
#include <queue> using namespace std; #define maxn 20005
#define mlog 16
#define inf (0x3f3f3f3f) void Finout()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
#endif
} int Getint()
{
int x=0,f=1; char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0'&&ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
} int T;
double x1,x2,x3,y1,y2,y3;
double a,b,c,t,k; int main()
{
Finout();
T=Getint();
while (T--)
{
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
k=(y3-y2)/(x3-x2);
t=y3-x3*k;
a=(y2-y1)/((x1-x2)*(x1-x2));
b=-x1*2*a;
c=y1-a*x1*x1-b*x1;
printf("%.2f\n",(a/3*x3*x3*x3+(b-k)/2*x3*x3+x3*(c-t))-(a/3*x2*x2*x2+(b-k)/2*x2*x2+x2*(c-t)));
}
}
最新文章
- iOS类中的属性设置背景色(统一)
- Javascript - Arraylike的7种实现
- DOM操作基础
- JSP lifecycle - with servlet
- jquery 实现页面拖拽并保存到cookie
- (大数据工程师学习路径)第一步 Linux 基础入门----用户及文件权限管理
- 为ASP.NET MVC应用程序使用高级功能
- html .css 实现图片滑动和自动播放特效移动端 HTML 5中添加了以touch 开头的事件
- HDU1394(线段树||树状数组)
- 基于Mac制作iPhone铃声教程,iTunes定制铃声
- Nginx详细安装部署教程
- PHP常用的函数与小技巧
- Install OpenCV on Ubuntu or Debian
- JS 存储
- 修改host文件——mac
- Subversion detected an unsupported working copy version
- /etc/profile不生效问题
- Zabbix应用一:Zabbix安装
- 1-求组合数(c(n, m))的几种方法
- 在IDEA中 SFTP 进行发布操作