TZOJ5255: C++实验:三角形面积
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cmath>
using namespace std;
class CPoint
{
public:
int x,y;
CPoint(int x=,int y=):x(x),y(y){}
friend istream &operator>>(istream &is,CPoint &p)
{
is>>p.x>>p.y;
return is;
} };
class CTriangle
{
public:
CPoint p1,p2,p3;
CTriangle(CPoint p1,CPoint p2,CPoint p3):p1(p1),p2(p2),p3(p3){}
double Area()
{
double a=sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
double b=sqrt((p1.x-p3.x)*(p1.x-p3.x)+(p1.y-p3.y)*(p1.y-p3.y));
double c=sqrt((p3.x-p2.x)*(p3.x-p2.x)+(p3.y-p2.y)*(p3.y-p2.y));
double p=(a+b+c)/2.0;
double s=sqrt(p*(p-a)*(p-b)*(p-c));
return s;
}
};
TZOJ5255: C++实验:三角形面积的更多相关文章
- ytu 1058: 三角形面积(带参的宏 练习)
1058: 三角形面积 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 190 Solved: 128[Submit][Status][Web Boar ...
- UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)
Problem ATriangle Fun Input: Standard Input Output: Standard Output In the picture below you can see ...
- OpenJudge计算概论-计算三角形面积【海伦公式】
/*============================================== 计算三角形面积 总时间限制: 1000ms 内存限制: 65536kB 描述 平面上有一个三角形,它的 ...
- bzoj 1845: [Cqoi2005] 三角形面积并 扫描线
1845: [Cqoi2005] 三角形面积并 Time Limit: 3 Sec Memory Limit: 64 MBSubmit: 848 Solved: 206[Submit][Statu ...
- nyoj 67 三角形面积【三角形面积公式】
三角形面积 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 给你三个点,表示一个三角形的三个顶点,现你的任务是求出该三角形的面积 输入 每行是一组测试数据,有6个 ...
- NYOJ 67 三角形面积(线代,数学)
三角形面积 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 给你三个点,表示一个三角形的三个顶点,现你的任务是求出该三角形的面积 输入 每行是一组测试数据,有6个 ...
- BZOJ 1845: [Cqoi2005] 三角形面积并 [计算几何 扫描线]
1845: [Cqoi2005] 三角形面积并 Time Limit: 3 Sec Memory Limit: 64 MBSubmit: 1151 Solved: 313[Submit][Stat ...
- TZOJ 2519 Regetni(N个点求三角形面积为整数总数)
描述 Background Hello Earthling. We're from the planet Regetni and need your help to make lots of mone ...
- [CQOI2005]三角形面积并
[CQOI2005]三角形面积并 题目大意: 求\(n(n\le100)\)个三角形的面积并. 思路: 自适应辛普森法,玄学卡精度可过. 源代码: #include<cmath> #inc ...
- FZU 2273 Triangles 第八届福建省赛 (三角形面积交 有重边算相交)
Problem Description This is a simple problem. Given two triangles A and B, you should determine they ...
随机推荐
- learning at command AT+CPIN
[Purpose] Learning how to check sim ready? [Eevironment] Shell terminal, base on gcom command and gc ...
- My journey introducing the data build tool (dbt) in project’s analytical stacks
转自:https://www.lantrns.co/my-journey-introducing-the-data-build-tool-dbt-in-projects-analytical-stac ...
- 控制论模型&心流模型&波模型
1.控制论模型 这是对设定的目标,通过多次输入和输出,反馈调节,最终达成目标的方法.广泛运用于自然科学与社会科学中.反馈的周期长短决定了调节精度的大小以及达到目标的速度.反馈结果与目标背离的立即纠正, ...
- 修改git 提交的用户名和用户Email命令
首页先查看全局配置:git config --list git config --local --list 法一:使用命令修改git的用户名和提交的邮箱 )修改全局 如果你要修改当前全局的用户名和邮箱 ...
- [USACO06FEB] Stall Reservations 贪心
[USACO06FEB] Stall Reservations 贪心 \(n\)头牛,每头牛占用时间区间\([l_i,r_i]\),一个牛棚每个时间点只能被一头牛占用,问最少新建多少个牛棚,并且每头牛 ...
- 使用Sublime Text 写Processing
本来以为是个很简单的事情,没想到一波三折~ 1.下载Sublime Text 3(中文版)并且安装,没啥好说的 2.打开[工具 - 命令面板 - install package],接着就报错了 “Th ...
- Flume 测试 Kafka 案例
Flume Kafka 测试案例,Flume 的配置. a1.sources = s1 a1.channels = c1 a1.sinks = k1 a1.sources.s1.type = netc ...
- pytorch中tensor数据和numpy数据转换中注意的一个问题
转载自:(pytorch中tensor数据和numpy数据转换中注意的一个问题)[https://blog.csdn.net/nihate/article/details/82791277] 在pyt ...
- udf也能用Python
具体步骤见<fluent加载第三方(C++,Fortran等)动态链接库> 我们对导入的动态链接库进行改动 打开VS2013 完成了上述过程以后,还需要配置Python 首先需要安装Pyt ...
- 文献阅读 | A single-cell molecular map of mouse gastrulation and early organogenesis
A single-cell molecular map of mouse gastrulation and early organogenesis Here we report the transcr ...