UVALive 6741 The Sacrificial Firepits
来源:互联网 发布:apache spark hadoop 编辑:程序博客网 时间:2024/05/03 05:32
简单的几何水题,就是给出两个等边三角形的Size,用一个矩形去cover这两个三角形。求这样的矩形的最小面积。
#include <cstdio>#include <cmath>#include <algorithm>using namespace std;int main(){ int i, t; scanf("%d", &t); while ( t -- ) { int s1, s2; double ans = 0; scanf("%d%d", &s1, &s2); if ( s1 > s2 ) swap(s1, s2); if ( s1 == s2 ) ans = sqrt(3) * s1 * s1 / 4 * 3;//两个等边三角形直接边对边,变成平行四边形那样 else if ( s1 * 2 <= s2 ) ans = sqrt(3) * s2 * s2 / 2;//取变长较长的作为矩形的底边 else if ( s1 * 2 > s2 ) ans = sqrt(3) * s2 / 2 * ( s1 + s2 * 0.5); printf("%.3lf\n", ans); } return 0;}
0 0
- UVALive 6741 The Sacrificial Firepits
- UVALive 3637 The Bookcase
- UVALive - 3637 The Bookcase
- UVALive 6937 The Imp
- Paint the Roads UVALive
- Save the Students! UVALive
- Cross the Wall UVALive
- UVALive 3942 Remember the Word
- UVALive - 3693 Balancing the Scale
- UVALive - 6322 The Swapping Game
- UVALive 5072 Find the Multiples
- UVALive 6436 The Busiest City
- UVAlive 4683 Find The Number
- uvaLive 2701 Find The Multiple
- UVALive - 2701 Find The Multiple
- UVALive 7146 Defeat the Enemy
- UVALive 6680 Join the Conversation
- UVALive 6680Join the Conversation
- hadoop安装
- 经历过的一款游戏的失败历程
- NYOJ 题目860 又见01背包(01背包变形)
- 最大子序列和问题以及确定序列起终点位置
- 如何使用Instruments
- UVALive 6741 The Sacrificial Firepits
- 番茄工作法践行 2015-1-31
- 列记录转换为行记录
- hdu 1864 背包问题
- powerpc instructioin set
- 安装Centos 7与Win7双系统,找不到Win7启动项
- TCPDump抓包&WireShark分析
- 三大框架的理解
- powerpc 汇编编程参考