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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • HTML与XML的区别(转)

    什么是HTML  HTML的全拼是Hypertext Markup Language, 中文也就是超文本链接标示语言。HTML(HyperTextMark-upLanguage)即超文本标记语言,是WWW的描述语言。设计HTML语言的目的是为了能把存放在一台电脑中的文本或图形与另一台电脑中的文本或图形方便地联系在一起,形成有机的整体,人们不用考虑具体信息是在当前电脑上还是在网络的其它电脑上。我们只需

    2022年2月25日
    54
  • docker安装elasticsearch(最详细版)[通俗易懂]

    docker安装elasticsearch(最详细版)[通俗易懂]docker安装elasticsearch1.设置max_map_count不能启动es会启动不起来查看max_map_count的值默认是65530cat/proc/sys/vm/max_map_count重新设置max_map_count的值sysctl-wvm.max_map_count=2621442.下载镜像并运行#拉取镜像dockerpullelasticsearch:6.5.4#启动镜像dockerrun–nameelasticsearch-d

    2022年6月11日
    78
  • 双绞线制作实验报告心得体会_制作网络双绞线实验心得

    双绞线制作实验报告心得体会_制作网络双绞线实验心得参考各路资料。不一一指出。一、实验目的:(1)学会两种双绞线制作方法;(2)掌握剥线/压线钳和普通网线测试仪的使用方法;(3)了解双绞线和水晶头的组成结构;(4)了解各网络设备之间网线连接的特点。二、实验项目:(1)直通线的制作(2)交叉线制作三、实验准备1、相关知识的准备(1)RJ-45水晶头结构(2)做线工具 剥线/压线钳

    2025年8月2日
    3
  • mapper.xml作用_mapper foreach

    mapper.xml作用_mapper foreach今天测试mybatis接口时遇到一个小问题,花了好长时间Failedtoinstantiate[org.apache.ibatis.session.SqlSessionFactory]:Factorymethod’sqlSessionFactory’threwexception;nestedexceptionisorg.springframework.core.NestedIOException:Failedtoparsemappingresource:’file[E

    2022年9月30日
    3
  • 更改nginx端口_nginx 端口映射

    更改nginx端口_nginx 端口映射Postedby撒得一地on2015年8月25日innginx笔记nginx相关文章在web服务器中,不管是Apache还是Nginx,这些服务器默认占用的端口都是80端口。但是,有时候80端口被占用,或者一些其他原因,我们需要这些服务工作在非80端口上,那么如何修改Nginx默认端口,使其占用8089端口(或者其它非80端口),方法步骤如下:1.首先修改nginx根目录下的配置文件n…

    2025年10月7日
    4
  • node.js linux安装_node安装及环境配置

    node.js linux安装_node安装及环境配置版本:node-v10.16.0-linux-x64.tar.xzwgethttps://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz1、上传到服务器目录:/usr/local/soft2、解压安装包cd/usr/local/softtarzxvfnode-v8.9.1-linux-x64.tar.gz…

    2025年11月2日
    7

发表回复

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

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