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


相关推荐

  • 安装tensorflow GPU版本–tensorflow-gpu版本与CUDA版本对应关系(持续更新,目前到TF2.7)「建议收藏」

    安装tensorflow GPU版本–tensorflow-gpu版本与CUDA版本对应关系(持续更新,目前到TF2.7)「建议收藏」一、WIndows安装GPU版本tensorflow注意一下几个问题一般就不会出错(1)确定自己要安装哪个版本的tensorflow-gpu;(1)根据自己要装的tensorflow-gpu版本确定要下载的CUDA版本;(2)根据要安装的CUDA版本确定要下载的Cudnn版本。二、tensorflow-gpu版本与CUDA版本对应关系不同版本的tensorflow-gpu与CUDA对应关…

    2022年5月16日
    556
  • git基本使用(超详细)[通俗易懂]

    git基本使用(超详细)[通俗易懂]git基本使用一:Git是什么?Git是目前世界上最先进的分布式版本控制系统。二:SVN与Git的最主要的区别?1.SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首先要从中央服务器哪里得到最新的版本,然后干活,干完后,需要把自己做完的活推送到中央服务器。集中式版本控制系统是必须联网才能工作,如果在局域网还可以,带宽够大,速度够快,如果在互联网下,如果网速慢的话,就纳闷了。2.Git是分布式版本控制系统,那么它就没有中央服务器的,每个人的电脑就是一个

    2022年9月21日
    0
  • 安全测评第一股——河南鑫安利选择契约锁电子签章

    安全测评第一股——河南鑫安利选择契约锁电子签章

    2021年6月18日
    108
  • Kafka集群配置

    Kafka集群配置之前一篇博文简单讲述了zookeeper和kafka的单机配置,详细可以参考《Linux(CentOS)中常用软件安装,使用及异常——Zookeeper,Kafka》。本文只要讲述Kafka集群的配置事项,包括zookeeper集群的配置。本文讲述的前提是kafka和zookeeper在单机情况下已正确安装和配置。如有疑问,可以参考《Linux(CentOS)中常用软件安装,使用及异常——Z…

    2022年4月25日
    61
  • vue-router路由懒加载以及三种实现方式「建议收藏」

    vue-router路由懒加载以及三种实现方式「建议收藏」什么是路由懒加载?也叫延迟加载,即在需要的时候进行加载,随用随载。官方解释: 1:当打包构建应用时,JavaScript包会变得非常大,影响页面加载。 2:如果我们能把不同路由对应的组件分割成不同的代码块,然后当路由被访问的时候才加载对应组件,这样就更加高效了。官方在说什么呢?为什么需要懒加载? 1:首先,我们知道路由中通常会定义很多不同的页面。 2:这个页面这项目build打包后,一般情况下,会放在一个单独的js文件中 3:但是,如果很多的页面都放在同一个js文件.

    2022年10月6日
    0
  • 特征选择方法之信息增益

    特征选择方法之信息增益

    2021年12月9日
    39

发表回复

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

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