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 ...
随机推荐
- 兼容iOS 10:配置获取隐私数据权限声明
原文链接 iOS 10的一大变化是更强的隐私数据保护.在文档中是这么描述的: You must statically declare your app’s intended use of protec ...
- 在HTML中禁止文字的复制
很简单,只需在<body>中添加如下代码: <body oncontextmenu='return false' ondragstart='return false' onsele ...
- LeetCode : 93. Restore IP Addresses
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABZ4AAAHUCAYAAAC6Zj2HAAAMFGlDQ1BJQ0MgUHJvZmlsZQAASImVlw
- 数据结构和算法 – 10.集合
集合: 联合.交叉.差异.子集 using System; using System.Collections; using System.Collections.Generic; using Syst ...
- EF – 4.CRUD与事务
5.6.1 <Entity Framework数据更新概述> 首先介绍Entity Framework实现CRUD的基本方法,接着介绍了如何使用分部类增强和调整数据实体类的功能与行为特性 ...
- GBDT原理实例演示 1
考虑一个简单的例子来演示GBDT算法原理 下面是一个二分类问题,1表示可以考虑的相亲对象,0表示不考虑的相亲对象 特征维度有3个维度,分别对象 身高,金钱,颜值 cat dating.txt ...
- Delphi面向对象的可见性表示符
Delphi能通过在声明域和方法的时候用protected.private.public.published和automated指示符来对对象提供进一步的控制.使用这些关键字的语法如下 TSomeOb ...
- Sql Server 索引之唯一索引和筛选索引
唯一索引(UNIQUE INDEX) 当主键创建时如果不设置为聚集索引,那么就一定是唯一的非聚集索引.实际上,唯一索引,故名思议就是它要求该列上的值是唯一的.唯一索引能够保证索引键中不包含重复的值, ...
- AOJ789 买酒
买酒 Time Limit: 1000 ms Case Time Limit: 1000 ms Memory Limit: 64 MBTotal Submission: 70 Submis ...
- 限制非安全IP访问
这个是一个检测ip是否非法的php函数,适应于白名单,黑名单功能开发,主要场景应用于:api来源限制,访问限制等. /** * 安全IP检测,支持IP段检测 * @param string $ip 要 ...