POJ 2208 已知边四面体六个长度,计算体积

POJ 2208 已知边四面体六个长度,计算体积

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

Pyramids
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 2718   Accepted: 886   Special Judge

Description

Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ancient pyramids. But unlike those in Egypt and Central America, they have triangular (not rectangular) foundation. That is, they are tetrahedrons in mathematical sense. In order to find out some important facts about the early society of the country (it is widely believed that the pyramid sizes are in tight connection with Farland ancient calendar), Mr. Archeo needs to know the volume of the pyramids. Unluckily, he has reliable data about their edge lengths only. Please, help him!

Input

The file contains six positive integer numbers not exceeding 1000 separated by spaces, each number is one of the edge lengths of the pyramid ABCD. The order of the edges is the following: AB, AC, AD, BC, BD, CD.

Output

A real number — the volume printed accurate to four digits after decimal point.

Sample Input

1000 1000 1000 3 4 5

Sample Output

依据边来求出四面体的高,然后公式计算。

代码:

/* ***********************************************
Author :_rabbit
Created Time :2014/5/9 21:32:01
File Name :5.cpp
************************************************ */
#pragma comment(linker, "/STACK:102400000,102400000")
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <string>
#include <time.h>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
double volume(double a,double b,double c,double d,double e,double f){
	double a2=a*a,b2=b*b,c2=c*c,d2=d*d,e2=e*e,f2=f*f;
	double tr1=acos((c2+b2-f2)/(2*b*c));
	double tr2=acos((a2+c2-e2)/(2*a*c));
	double tr3=acos((a2+b2-d2)/(2*a*b));
	double tr4=(tr1+tr2+tr3)/2;
	double temp=sqrt(sin(tr4)*sin(tr4-tr1)*sin(tr4-tr2)*sin(tr4-tr3));
	return a*b*c*temp/3;
}
int main()
{
     //freopen("data.in","r",stdin);
     //freopen("data.out","w",stdout);
     double a,b,c,d,e,f;
	 while(cin>>a>>b>>c>>d>>e>>f)printf("%.4f\n",volume(a,b,c,d,e,f));
     return 0;
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/117405.html原文链接:https://javaforall.net

(0)
上一篇 2022年1月6日 上午11:00
下一篇 2022年1月6日 下午12:00


相关推荐

  • FEC相关知识「建议收藏」

    FEC相关知识「建议收藏」1概念和原理前向纠错前向纠错也叫前向纠错码(ForwardErrorCorrection,简称FEC),是增加数据通讯可信度的方法。在单向通讯信道中,一旦错误被发现,其接收器将无权再请求传输。FEC是利用数据进行传输冗余信息的方法,当传输中出现错误,将允许接收器再建数据。常用的前向纠错码(1)电视传输专用的前向纠错码电视节目广播前向纠错采用2/3码率格形码、卷积交织

    2022年8月11日
    8
  • 内部类(成员内部类、静态内部类、方法内部类)

    内部类(成员内部类、静态内部类、方法内部类)一:成员内部类:最常见的内部类就是成员内部类,也称作普通内部类;1、Inner类定义在Outer类的内部,相当于Outer类的成员变量的位置,Inner类可以使用任意访问修饰符,如:public、private、protected等。2、Inner类中定义的test()方法可以访问Outer类中的数据,不受访问控制符的影响。3、定义了成员内部类后,必须使用外部类对象来创建内部类对象,而不能直接去……

    2022年10月11日
    3
  • 如何快速查看颜色十六进制

    如何快速查看颜色十六进制1 Ctrl Alt A2 Ctrl C

    2026年3月18日
    5
  • Matlab中lsim函数使用

    Matlab中lsim函数使用lsim函数:lsim函数是针对线性时不变模型,给定任意输入,得到任意输出。lsim函数表示任意输入函数的响应,连续系统对任意输入函数的响应可以利用lsim函数求取。语法(常用):1.分子分母形式lsim(num,den,u,t)2.传递函数形式lsim(sys,u,t)3.状态空间形式lsim(A,B,C,D,u,t)其中,u为由给定输入序列构成的矩阵,它的每列对应一个输入,每行对应一个新的时间点,其行数与时间t的长度相等,其它的用法与step函数相同。…

    2022年7月17日
    140
  • 新手小白怎么用u盘装电脑系统步骤详细指南 新手如何用u盘安装系统

    新手小白怎么用u盘装电脑系统步骤详细指南 新手如何用u盘安装系统

    2026年3月14日
    3
  • 实时操作系统UCOS学习笔记1—-UCOSII简介

    实时操作系统UCOS学习笔记1—-UCOSII简介前面我们所有的实验都是跑的裸机程序(裸奔),从本章开始,我们开始介绍UCOSII(实时多任务操作系统内核)。UCOSII简介UCOSII的前身是UCOS,最早出自于1992年美国嵌入式系统专家JeanJ.Labrosse在《嵌入式系统编程》杂志的5月和6月刊上刊登的文章连载,并把UCOS的源码发布在该杂志的BBS上。目前最新的版本:UCOSIII已经出来,但是现在使用最为广泛的还是UCOSII,本章主要针对UCOSII进行介绍。UCOSII是一个可以基于ROM运行的、可裁剪的、抢占式、实时多任务内核

    2022年6月3日
    40

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号