ZOJ 3752 The Three Guys
来源:互联网 发布:linux重启weblogic服务 编辑:程序博客网 时间:2024/05/01 10:52
The Three Guys
三个人围成一个圆圈,所以a,b,c和a,c,b等组合其实是相同的。
只要考虑这个人是顺时针还是逆时针即可,有8种情况。
对于每种情况,6个线段围成一圈,分成三角形的三条边,求面积即可
#include<cstdio>#include<iostream>#include<string.h>#include<cmath>using namespace std;double ans;double s(double len1,double len2,double len3){ double t=(len1+len2+len3)/2;double c=t*(t-len1)*(t-len2)*(t-len3);if(c<=0) return -1; return sqrt(c);}void circle(double l1,double l2,double l3,double l4,double l5,double l6){double a[14]={l1,l2,l3,l4,l5,l6};for(int i=0;i<6;i++)for(int j=i+1;j<6;j++)for(int k=j+1;k<6;k++){double len1=0,len2=0,len3=0;for(int p=i;p<j;p++) len1+=a[p];for(int p=j;p<k;p++) len2+=a[p];for(int p=k;p<i+6;p++) len3+=a[p%6];//printf("%lf %lf %lf =%lf\n",len1,len2,len3,s(len1,len2,len3));ans=max(ans,s(len1,len2,len3));}}int main(){double u1,u2,u3,l1,l2,l3;while(cin>>u1>>l1>>u2>>l2>>u3>>l3){ans=0;circle(u1,l1,u2,l2,u3,l3);//顺顺顺circle(u1,l1,u2,l2,l3,u3);//顺顺逆circle(u1,l1,l2,u2,u3,l3);//顺逆顺circle(u1,l1,l2,u2,l3,u3);//顺逆逆circle(l1,u1,u2,l2,u3,l3);//逆顺顺circle(l1,u1,u2,l2,l3,u3);//逆顺逆circle(l1,u1,l2,u2,u3,l3);//逆逆顺circle(l1,u1,l2,u2,l3,u3);//逆逆逆printf("%.9lf\n",ans);}return 0;}
0 0
- ZOJ 3752 The Three Guys
- ZOJ - 3752 The Three Guys
- ZOJ 3752The Three Guys(暴力)
- ZOJ-3752-The Three Guys【暴力】
- ZOJ Monthly, January 2014 F The Three Guys (浙江大学月赛)
- ZOJ-3900-Three Circles
- ZOJ 2371 数论Three powers
- zoj 3516 Tree of Three
- ZOJ 3516 Tree of Three
- The Three Principal Layers
- The Rule of Three
- The Big Three Rule
- The Rule of Three
- The Three Ws
- ZOJ 3516 Tree of Three(DFS)
- ZOJ-#3516Tree of Three(dfs+vector)
- The Three Faces of SOA
- The Three Kinds of Laziness
- 模线性方程
- O(n)
- hdu 2340 Obfuscation
- LeetCode OJ:Combination Sum
- phonegap3.3学习(一)---配置
- ZOJ 3752 The Three Guys
- OSGi原理与最佳实践(精选版
- 第6章 Android应用的资源
- 电商seo培训之卖家搜索优化步骤
- Python学习系列九:函数对象
- 真命题、假命题、贝叶斯算法与伪命题
- 2000——ASCII码排序
- java线程之join
- 写博客、读博客的一些事儿