ural 1075. Thread in a Space
1075. Thread in a Space
Memory limit: 64 MB
Input
Output
Sample
input | output |
---|---|
0 0 12 |
19.71 |
Problem Source: Ural State Univerisity Personal Contest Online February'2001 Students Session
/**
Create By yzx - stupidboy
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef double DB;
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair inline int Getint()
{
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const DB EPS = 1e-;
struct Point
{
DB x, y, z;
inline void Read()
{
cin >> x >> y >> z;
}
} a, b, c;
DB r; inline void Input()
{
a.Read();
b.Read();
c.Read();
cin >> r;
} inline DB Sqr(DB x)
{
return x * x;
} inline DB Dist(Point a, Point b)
{
return sqrt(Sqr(a.x - b.x) + Sqr(a.y - b.y) + Sqr(a.z - b.z));
} inline void Solve()
{
DB ans = 0.0; DB ab = Dist(a, b),
ac = Dist(a, c),
bc = Dist(b, c); DB angle =
acos((Sqr(ac) + Sqr(bc) - Sqr(ab)) / (2.0 * ac * bc)) -
acos(r / ac) - acos(r/ bc);
if(angle <= EPS)
{
printf("%.2lf\n", ab);
return;
} ans += sqrt(Sqr(ac) - Sqr(r));
ans += sqrt(Sqr(bc) - Sqr(r));
ans += angle * r; printf("%.2lf\n", ans);
} int main()
{
freopen("g.in", "r", stdin);
Input();
Solve();
return ;
}
ural 1075. Thread in a Space的更多相关文章
- Ural Vol1(dif>=900)
目前已AC: 2 1040.Airline Company(构造) 题目要求与每个顶点相连的所有边编号最大公约数为1,其实只要其中的两条边编号互质,所有边编号的最大公约数一定为1.我们知道相邻的数字 ...
- URAL 1707. Hypnotoad's Secret(树阵)
URAL 1707. Hypnotoad's Secret space=1&num=1707" target="_blank" style="" ...
- Thread Costs
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/CreatingTh ...
- PatentTips – GPU Saving and Restoring Thread Group Operating State
BACKGROUND OF THE INVENTION The present invention relates generally to single-instruction, multiple- ...
- Difference between Process and thread?
What are the differences between a process and a thread? How are they similar? How can 2 threads com ...
- karottc A Simple linux-virus Analysis、Linux Kernel <= 2.6.37 - Local Privilege Escalation、CVE-2010-4258、CVE-2010-3849、CVE-2010-3850
catalog . 程序功能概述 . 感染文件 . 前置知识 . 获取ROOT权限: Linux Kernel <= - Local Privilege Escalation 1. 程序功能概述 ...
- MIT jos 6.828 Fall 2014 训练记录(lab 3)
注:源代码参见我的github: https://github.com/YaoZengzeng/jos Part A : User Environments and Exception Handlin ...
- ltrace killed by SIGTRAP
[Ltrace-devel] ltrace stucks with pthreads Heiko Carstens heiko.carstens at de.ibm.comFri Apr 14 11: ...
- EMC题2
易安信笔试题分享:1 protected成员函数能被肿么调用2 “has-a” relationship是指的啥,答案有instance, reference, pointer等...3 int, c ...
随机推荐
- SQL语句简介
1.Top.Distinct Top 获取前几条数据,top一般都与order by连用 获得年纪最小的5个学生 select top 5 * from A order by classesId 获 ...
- XMPP框架下微信项目总结(5)花名册获取(好友列表)
---->概念 ---->添加花名册 ps:添加花名册,启动: 客户端发送请求到服务器获取好友列表信息,同时在项目中创建数据表,并保存好友列表到数据表中. ---->获取服务器保存好 ...
- 数据结构之AVL树
AVL树是高度平衡的而二叉树.它的特点是:AVL树中任何节点的两个子树的高度最大差别为1. 旋转 如果在AVL树中进行插入或删除节点后,可能导致AVL树失去平衡.这种失去平衡的可以概括为4种姿态:LL ...
- Quartus ii 12.1软件破解之后编译原有的工程出现报警错误的解决办法
在Quartus ii 12.1软件破解之后,想用来编译原来编译过的工程,但是编译到最后出现下面两个错误警告: 原来以为没有破解成功或者安装的时候有文件被杀毒软件吃了,导致安装错误,又重新安装了两次都 ...
- 快速反编绎jar war包
反编译这些class文件或jar包或war包,用TTools https://github.com/Supermax197/TTools [root@ok action]# tree /home/ok ...
- WMI测试
https://social.msdn.microsoft.com/Forums/windowshardware/zh-CN/c5af7959-95d3-4e1b-ab40-96a2a31c2af2/ ...
- CI重定向:php(codeigniter)中如何重定向
Q: 在保存完数据之后需要重定向,防止数据重复提交. 我使用$this->方法名();跳转,发现不能达到重定向的效果(地址栏没变) 请教高手重定向怎么用 A: $this->load-&g ...
- Window Server 2003(IIS6) 安装.net4.0遇到的问题总结
1.Window server 2003系统原本就装了.net1.0..net2.0 ,安装.net 4.0之前,系统已经发不了一些网站,这个时候,我安装.net 4.0返现程序不能访问了,提示ser ...
- [LeetCode] Gas Station
Recording my thought on the go might be fun when I check back later, so this kinda blog has no inten ...
- Oralce sysaux WRH$_ACTIVE_SESSION_HISTORY清理
In this Document Symptoms Cause Solution References Symptoms sysaux表空間的WRH$_ACTIVE_SESSION_HISTORY表變 ...