且未

博客园 首页 新随笔 联系 订阅 管理

题目

题意:已知p1,p2,p3三点求抛物线和直线围成的面积。

核心代码就一行,结果够推两个小时了。

#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;

int main()
{
    double x1,x2,x3,y1,y2,y3;
    double res;
    int T;
    cin>>T;
    while(T--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        res = (y1-y3)*(x3-x2)-((y1-y3)*(pow((x3-x1),3)-pow((x2-x1),3)))/(3.0*(x1-x3)*(x1-x3))+(y3-y2)*(x3-x2)/2.0;
        printf("%.2lf\n",res);
    }
    return 0;
}

 

posted on 2018-11-01 16:38  阿聊  阅读(126)  评论(0编辑  收藏  举报