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


相关推荐

  • dll文件注册器_怎么注册dll文件win10

    dll文件注册器_怎么注册dll文件win10点击  开始\所有程序\MicrosoftVisualStudio2008\VisualStudioTools 以管理员身份运行VisualStudio2008CommandPrompt。//注册Dll在VisualStudio2008CommandPrompt键入E:\>regasmmydll.dll.eg:E:\>regasmE:\Assig

    2022年8月22日
    5
  • EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)[通俗易懂]

    EagleEye: Fast Sub-net Evaluation for Efficient Neural Network Pruning(论文阅读)[通俗易懂]目录说明动机贡献方法发现EagleEye剪枝算法实验实验1-相关性的定量分析实验2-基于自适应BN的评估方法的通用性实验3-从修剪候选中选择最佳修剪策略的计算成本实验4-Effectivenessofourproposedmethod总结与讨论说明找出训练好的深度神经网络(DNN)的计算冗余部分是剪枝算法要解决的关键问题。许多算法都试图通过引入各种评估方法来预测修剪后的子网的模型性能。在这个工作中,我们提出了一种称为EagleEye的剪枝方法,其中使用了一个基于自适应批归一化adaptiv

    2022年8月16日
    8
  • 有极性电容和无极性电容的区别_非极性电容

    有极性电容和无极性电容的区别_非极性电容有极性电容与无极性电容的概述有极性电容与无极性电容的概述有极性电容的识别有极性电容于无极性电容的区别网友见解有极性电容与无极性电容的概述理想的电容,本来是没有极性的。但是在实际中,为了获得大容量,就使用了某些特殊的材料和结构,这就导致了实际的电容有些是有极性的。常见的有极性电容有铝电解电容,钽电解电容等。电解电容一般是容量相对比较大的。如果要做一个大容量的无极性电容,就没那…

    2022年8月22日
    9
  • 华为交换机vlan配置教程

    华为交换机vlan配置教程Sys  \\进入系统视图Dhcpenable \\全局开启dhcp功能Vlanbacth234 \\批量创建vlan 234Intvlanif2 \\进入vlan 2Ipadd192.168.xxx.1 255.255.255.0 \\为vlan2分配IP地址及子网掩码Dhcpselectglobal\\dhcp选择全局开启Q \…

    2025年11月22日
    5
  • jq 获取有焦点的input_jquery获得焦点和失去焦点

    jq 获取有焦点的input_jquery获得焦点和失去焦点前端网站中如果存在一些让用户填写内容的表单元素的话,我们可以使用JQ中获得焦点事件和失去焦点事件,来给用户作出一些提示的内容。今天我们就说一说JQuery下获得焦点和失去焦点的事件的使用方法。jqueryfocus()获得焦点事件focus()方法:当通过鼠标点击选中元素或通过tab键定位到元素时,该元素就会获得焦点。语法:例:input输入框获得焦点时改变其边框的颜色示例代码:当鼠标移入…

    2022年6月24日
    79
  • Mit6.S081-实验1-Xv6 and Unix utilities

    Mit6.S081-实验1-Xv6 and Unix utilitiesMit6.S081-实验1-Xv6andUnixutilities前言一、Bootxv61,实验目的2,操作流程1)切换到xv6-labs-2020代码库的lab1分支2)启动xv63)测试xv64)过程分析5)其他操作二、在xv6中添加一个自己编写的程序1,源码准备2,编译配置3,测试添加程序4,过程分析三、xv6中shell简析前言一、Bootxv61,实验目的利用qemu启动xv62,操作流程1)切换到xv6-labs-2020代码库的lab1分支gitcheckoutut

    2022年9月26日
    2

发表回复

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

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