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


相关推荐

  • 黑客[入门]

    黑客[入门]第1章黑客基础知识随着互联网技术的飞速发展,网络世界的安全性不断受到挑战。如果你要上网,就免不了遇到黑客的侵扰。本章就为大家介留一些最基本的黑客入门知识,揭密黑客常用的一些命令,当然这些微不足道的伎俩难以入侵戒备森严的网络,不过至少让初学者对黑客的“工作情形”有初步的认识。本章导读1.1黑客简单介绍最早的计算机于1946年在宾夕法尼亚大学出现,而最早的黑客出现于麻省理工学院(贝尔实验室也有)。最初的黑客一般都是一些高级的技术人员,他们热衷于挑战、崇尚自由并主张信息的共享。1…

    2022年5月8日
    65
  • Vue Router 的params和query传参的使用和区别(详尽)「建议收藏」

    Vue Router 的params和query传参的使用和区别(详尽)「建议收藏」首先简单来说明一下$router和$route的区别//$router:是路由操作对象,只写对象//$route:路由信息对象,只读对象//操作路由跳转this.$router.push({name:’hello’,params:{name:’word’,age:’11’}})//读取…

    2022年7月11日
    28
  • oracle创建用户并授权

    一、创建用户登录到system用户以创建其他用户创建的:createuserusernameidentifiedbypassword;二、授权在这里插入代码片

    2022年4月3日
    458
  • jdk1.8的环境配置「建议收藏」

    jdk1.8的环境配置「建议收藏」jdk1.8的环境配置原文地址:传送门每日必答:在开始之前呢,小Du来来带大家了解几个问题,希望能够在面试中,小Du的解答给你帮助。1.什么是JDK?答:javadevelopmentkit的缩写,意思是JAVA开发工具,我们写文档做PPT需要office办公软件,开发当然需要开发工具了,说到开发工具大家肯定会想到Eclipse,但是如果直接安装Eclipse你会发现它是运行不起来是会报错的,只有安装了JDK,配置好了环境变量和path才可以运行成功。2.JRE是什么?答:jav

    2022年6月11日
    35
  • ubuntu 18.04 ros melodic_ubuntu查看软件版本

    ubuntu 18.04 ros melodic_ubuntu查看软件版本1.ROS版本选择ROS是一个用于编写机器人软件的灵活框架,它集成了大量的工具、库、协议,提供了类似操作系统所提供的功能,包括硬件抽象描述、底层驱动程序管理、公用功能的执行、程序间的消息传递、程序发行包管理,可以极大简化繁杂多样的机器人平台下的复杂任务创建与稳定行为控制。ROS和Ubuntu版本安装对应关系ROS版本Ubuntu版本indigo14.04kinetic16.04melodic18.04ROS的安装方法主要有两种:软件源安装和源码编译安

    2022年9月10日
    0
  • Python 语法错误:“SyntaxError: invalid character in identifier“,原因及解决方法

    Python 语法错误:“SyntaxError: invalid character in identifier“,原因及解决方法SyntaxError:invalidcharacterinidentifier错误翻译语法错误:标识符中的无效字符。报错信息指着的位置有问题,报错了。原因一:冒号后面有制表符。原因二:或者第3行开头是制表符。python的缩进是4个空格,不能识别制表符。注:跟中文英文空格一点关系都没有!跟中文英文空格一点关系都没有!

    2022年6月23日
    176

发表回复

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

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