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


相关推荐

  • google cloud platform官网_ai智能体验店免费送

    google cloud platform官网_ai智能体验店免费送一、GoogleCloudPlatform(GCP)简介GoogleCloudPlatform(以下简称GCP)是Google提供的云平台,。Google云平台提供很多功能,包括计算服务,存储服务,网络服务,大数据服务,人工智能服务,以及谷歌的产品等,可以用来搭建加速服务,网站和存储数据等等。本文将介绍如何申请GCP一年的免费试用、Linux服务器环境搭建。Docker环境搭建…

    2022年10月23日
  • 高效工作指南

    高效工作指南

    2021年9月9日
  • Redis缓存穿透、缓存雪崩问题分析

    Redis缓存穿透、缓存雪崩问题分析把redis作为缓存使用已经是司空见惯,但是使用redis后也可能会碰到一系列的问题,尤其是数据量很大的时候,经典的几个问题如下:(一)缓存和数据库间数据一致性问题分布式环境下(单机就不用说了)非常容易出现缓存和数据库间的数据一致性问题,针对这一点的话,只能说,如果你的项目对缓存的要求是强一致性的,那么请不要使用缓存。我们只能采取合适的策略来降低缓存和数据库间数据不一致的概率,而无法保证两…

    2022年6月29日
  • mysql 视图 索引_mysql不走索引的情况

    mysql 视图 索引_mysql不走索引的情况mysql 索引和事务、视图

    2022年4月20日
  • Oracle ORA-01017: invalid username/password;logon denied问题解决「建议收藏」

    Oracle ORA-01017: invalid username/password;logon denied问题解决「建议收藏」问题描述:ORA-01017:invalidusername/password;logondenied问题分析:1、该登录用户没有权限。解决办法:第一步,打开SQLPlus第二步,输入用户名和密码。第三步,输入alterusersystemaccountlock;给用户解锁。第四步,输入connectsystem/123456assysdba给用户授权。注:system是用户名,123456是用户的密码。…

    2022年5月20日
  • 自定义序列类_自定义序列填充

    自定义序列类_自定义序列填充一.序列类型的分类1.容器序列(可以在容器中放置任意类型的数据)list、tuple、deque2.扁平序列str、bytes、bytearray、array.array(数组,同一类型数据

    2022年8月6日

发表回复

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

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