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


相关推荐

  • mysql insert sql

    mysql insert sql

    2022年3月4日
    35
  • Linux文件系统类型[通俗易懂]

    文件系统是操作系统用于明确磁盘或分区上的文件的方法和数据结构; 即在磁盘上组织文件的方法。也指用于存储文件的磁盘或分区一个分区或磁盘能作为文件系统使用前,需要初始化,并将记录数据结构写到磁盘上。这个过程就叫建立文件系统 种类:1 ext2与ext3是linux专门设计的硬盘文件系统一般称为扩展文件系统。Ext3增加了日志记录功能。fdisk 分区在终端会显示打印信息   mkfs.ext4 /de…

    2022年4月6日
    58
  • python for跳过下一个循环_python循环三次跳出循环

    python for跳过下一个循环_python循环三次跳出循环python中如何退出for循环Python中的for循环与其它语言不大一样,但跳出循环还是与大多数语言一样,可以使用关键字continue跳出本次循环或者break跳出整个for循环。break语句:Python中的break语句,就像在C语言中,打破了最小封闭for或while循环。break语句用来终止循环语句,即循环条件没有False条件或者序列还没被完全递归完,也会停止执行循环语句。br…

    2022年8月12日
    9
  • 51单片机:LED流水灯(仿真+代码)

    51单片机:LED流水灯(仿真+代码)这次用单片机做个简单的流水灯。先给大家看一下仿真软件的电路(软件为Proteus)上图就是用仿真软件制作的线路原理图AT89C51RC2:单片机BUTTON:按键CAP:电容CRYSTAL:晶振LED-GERRN:LED灯(绿色)RES:电阻接下来是程序部分(软件为keil)#include”reg51.h” //此文件中定义了单片机的一些特殊功能寄存器#include…

    2022年5月26日
    59
  • plsqldev8.0下载和注册码「建议收藏」

    plsqldev8.0下载和注册码「建议收藏」[b]关键词:PL/SQL,下载,plsqldev,注册码,plsqldev711,汉化文件[/b]PL/SQLDeveloper是一种集成的开发环境,专门用于开发、测试、调试和优化OraclePL/SQL存储程序单元,比如触发器等。PL/SQLDeveloper功能十分全面,大大缩短了程序员的开发周期。[url]http://www.kutoku.info/software…

    2022年4月25日
    43
  • java中的io模型_技术人才迁移到web3

    java中的io模型_技术人才迁移到web3原文地址:服务器端编程经常需要构造高性能的IO模型,常见的IO模型有四种:(1)同步阻塞IO(Blocking IO):即传统的IO模型。(2)同步非阻塞IO(Non-blocking IO):默认创建的socket都是阻塞的,非阻塞IO要求socket被设置为NONBLOCK。注意这里所说的NIO并非Java的NIO(New IO)库。(3)IO多路复

    2025年5月27日
    3

发表回复

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

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