XV Open Cup named after E.V. Pankratiev. GP of Siberia-Swimming
给出两个点,找到过这两个点的等角螺线,并求出中间的螺线长
$c = \frac{b}{a}$
$p = a \times c^{\frac{\theta}{angle}}$
对弧线积分
#include <bits/stdc++.h>
using namespace std;
long double eps = 1e-;
struct Point {
long double x, y;
Point(long double _x = , long double _y = ) {
x = _x; y = _y;
}
Point operator - (const Point &b) {
return Point(x - b.x, y - b.y);
}
}a[];
long double Dot(Point &a, Point b) {
return a.x * b.x + a.y * b.y;
}
long double len(Point &a) {
return sqrt(Dot(a, a));
}
int cmp(long double x) {
if (fabs(x) < eps) return ; return eps > ? : -;
}
int main() {
for (int i = ; i <= ; ++ i) cin >> a[i].x >> a[i].y;
a[] = a[] - a[];
a[] = a[] - a[];
long double tmp = Dot(a[], a[]);
long double len1 = len(a[]), len2 = len(a[]);
if (cmp(tmp - len1 * len2) == ) {
long double ans = fabs(len1 - len2);
cout << fixed << setprecision() << ans << '\n';
return ;
}
auto sqr = [&](long double x) -> long double {
return x * x;
};
long double ang = acos(tmp / len1 / len2);
long double ans = ang * len1;
if (cmp(len1 - len2)) {
long double C = len2 / len1;
ans = (C - ) / log(C) * ans;
ans = ans * sqrt( + sqr(log(C) / ang));
}
cout << fixed << setprecision() << ans << '\n';
}
XV Open Cup named after E.V. Pankratiev. GP of Siberia-Swimming的更多相关文章
- XV Open Cup named after E.V. Pankratiev. GP of Tatarstan
A. Survival Route 留坑. B. Dispersed parentheses $f[i][j][k]$表示长度为$i$,未匹配的左括号数为$j$,最多的未匹配左括号数为$k$的方案数. ...
- XV Open Cup named after E.V. Pankratiev. GP of America
A. Area of Effect 首先最优解中必有一个点在圆的边界上. 若半径就是$R$,则枚举一个点,然后把剩下的事件极角扫描即可,时间复杂度$O(m(n+m)\log(n+m))$. 否则圆必然 ...
- XV Open Cup named after E.V. Pankratiev. GP of Three Capitals
A. Add and Reverse 要么全部都选择$+1$,要么加出高$16$位后翻转位序然后再补充低$16$位. #include<stdio.h> #include<iostr ...
- XV Open Cup named after E.V. Pankratiev. GP of Central Europe (AMPPZ-2014)--J.Cave
给你一棵树,现在有m个专家,每个专家计划从$a_i$走到$b_i$, 经过的距离不超过$d_i$,现在让你找一个点,使得所有专家的路途都能经过这个点 令$S_i$表示满足第i个专家的所有点,先检查1可 ...
- XV Open Cup named after E.V. Pankratiev. GP of Central Europe (AMPPZ-2014)--B.Petrol
多源最短路+并查集 #include <bits/stdc++.h> using namespace std; #define rep(i, j, k) for (int i = int( ...
- XVI Open Cup named after E.V. Pankratiev. GP of Siberia
A. Passage 枚举两个点,看看删掉之后剩下的图是否是二分图. #include <bits/stdc++.h> using namespace std ; const int MA ...
- XVII Open Cup named after E.V. Pankratiev. GP of Siberia, Division 1
1. Ski race 枚举枚举倍数判断即可.时间复杂度$O(n\log m)$. #include<cstdio> #include<algorithm> using nam ...
- XV Open Cup named after E.V. Pankratiev Stage 6, Grand Prix of Japan Problem J. Hyperrectangle
题目大意: 给出一个$d$维矩形,第i维的范围是$[0, l_i]$. 求满足$x_1 + x_2 + ...x_d \leq s$ 的点构成的单纯形体积. $d, l_i \leq 300$ 题解: ...
- XVI Open Cup named after E.V. Pankratiev. GP of Eurasia
A. Nanoassembly 首先用叉积判断是否在指定向量右侧,然后解出法线与给定直线的交点,再关于交点对称即可. #include<bits/stdc++.h> using names ...
随机推荐
- python模块与路径
# 切记不能与方法函数同名,否则会报错!!! # python的模块与包 分为三种: #1.标准库 #2.第三方模块 #3.自定义模块 #python 模块的引入原理: # 加入你创建了一个模块,在i ...
- 【函数参数】什么是*args和**kwargs?
**args表示任何多个无名参数,它是一个tuple,Python将**args从开始到结束作为一个tuple传入函数 **kwargs表示关键字参数,它是一个dict,Python将**kwargs ...
- python之堡垒机(第九天)
本节作业: 通过使用paramiko和sqlalchemy实现堡垒机功能 主要功能实现: 1.用户登录堡垒机后,无需知道密码或密钥可以SSH登录远端服务器: 2.用户对一个组内所有主机批量执行指定命令 ...
- Linq组合查询与分页组合查询结合
1.组合查询 <div>姓名:<asp:TextBox ID="T1" runat="server"></asp:TextBox& ...
- nodejs基础快速上手
node 快速了解 hello node.js console.log("hello Node.js"); let http = require("http") ...
- PHP7.1 mcrypt_module_open() is deprecated
PHP7.1 mcrypt_module_open() is deprecated 一:函数前添加抑制符 @ mcrypt_module_open....;->@mcrypt_module_op ...
- MyPython
目录 Python,那些不可不知的事儿 Python简介 Python环境搭建 从Hello World开始 Python中的数据类型 函数 模块 面向对象 More Python,那些不可不知的事儿 ...
- 在ubuntu的bash中循环执行脚本,并在内存不足时重启
#!/bin/bash date ma=`grep MemAvailable /proc/meminfo | awk '{print $2}'` echo MemAvailable = $ma run ...
- ARDUINO入门按键通信试验
1.1按键实验 1.需要学习的知识: 1) Arduino 的输入口配置方法,配置函数的用法 通过pinMode()函数,可以将ADUINO的引脚配置(INPUT)输入模式 2) 搞懂什么是抖动 机械 ...
- 配置spring cache RedisCacheManager的序列化方法
通过查看autoconfigure源码 org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration; 部分源码如下: pr ...