#include<bits/stdc++.h>
const double PI=acos(-1.0);
const double TT=PI/;
using namespace std;
struct Point { double x,y; Point(){} Point(double x, double y) :x(x), y(y){} };;
struct Segment{ Point a,b; Segment(Point x,Point y ) { a=x;b=y; }; Segment(){}; };;
struct Line { Point a,b; Line(Point x,Point y ) { a=x;b=y; }; Line(){}; };;
typedef Point Point;
Point operator + (Point A, Point B){ return Point(A.x+B.x, A.y+B.y); } // 向量相加
Point operator - (Point A, Point B){ return Point(B.x-A.x, B.y-A.y); } // 向量生成 A-B;
double operator * (Point A, Point B){ return A.x*B.x-A.y*B.y; } // 点积
double operator ^ (Point A, Point B){ return A.x*B.y-A.y*B.x; } // 叉积
double Dot(Point A, Point B) { return A.x*B.x + A.y*B.y; } // 点积
double Cross(Point A, Point B) { return A.x*B.y-A.y*B.x; } // 叉积
double Length(Point A) { return sqrt(Dot(A, A)); } // 向量长度
double dis(Point a,Point b) { return sqrt( (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y) ); }
Line qq;
bool check(Segment A,Line B)
{
Point a=A.a; Point b=A.b;
Point c=B.a; Point d=B.b;
if(Cross(a-c,a-d)*Cross(b-c,b-d)> ) return ;
else return ;
return ;
}
Point make(Segment A,Line B)
{
Point a=A.a; Point b=A.b;Point c=B.a; Point d=B.b;
double A1=b.y-a.y,B1=-(b.x-a.x),C1=b.y*a.x-b.x*a.y;
double A2=d.y-c.y,B2=-(d.x-c.x),C2=d.y*c.x-d.x*c.y;
double k=A1*B2-A2*B1;
double x=-(B1*C2-C1*B2)*1.000000000/k;
double y=(A1*C2-C1*A2)*1.00000000/k;
Point kk; kk.x=x; kk.y=y; return kk;
}
double dfs(double l,int k,int d,Point x,double ff)
{
if(k==d) return ;
double ans=;
Segment x1;
x1.a=x;
x1.b.x=x.x+l*sin(ff); x1.b.y=x.y+l*cos(ff);
Point W;
W.x=x.x+l*sin(ff); W.y=x.y+l*cos(ff);
if(check(x1,qq)==)
{
ans+=l;
ans+=dfs(l/,k+,d,W,ff-TT);
ans+=dfs(l/,k+,d,W,ff);
ans+=dfs(l/,k+,d,W,ff+TT);
}
else
{
Point P=make(x1,qq); ans+=dis(x,P);
}
return ans;
}
void work(double l,int d)
{
Segment x1;
x1.a.x=; x1.a.y=;
x1.b.x=; x1.b.y=l;
double ans=;
Point W; W.x=; W.y=l;
if(check(x1,qq)==)
{
ans+=l;
ans+=dfs(l/,,d,W,-TT);
ans+=dfs(l/,,d,W,);
ans+=dfs(l/,,d,W,TT);
}
else
{
Point x;
x.x=;
x.y=;
Point P=make(x1,qq); ans+=dis(x,P);
}
cout<<ans<<endl;
}
int main()
{
cout<<fixed<<setprecision();
int T; cin>>T;
while(T--)
{
int d;
double l,x1,y1,k; cin>>l>>d>>x1>>y1>>k;
qq.a.x=x1; qq.a.y=y1;
qq.b.x=x1+; qq.b.y=y1+k*;
work(l,d);
}
}

2019南昌邀请赛 L 计算几何 G(待补)的更多相关文章

  1. 2019南昌邀请赛网络预选赛 M. Subsequence

    传送门 题意: 给出一个只包含小写字母的串 s 和n 个串t,判断t[i]是否为串 s 的子序列: 如果是,输出"YES",反之,输出"NO": 坑点: 二分一 ...

  2. 2019南昌邀请赛网络预选赛 J.Distance on the tree(树链剖分)

    传送门 题意: 给出一棵树,每条边都有权值: 给出 m 次询问,每次询问有三个参数 u,v,w ,求节点 u 与节点 v 之间权值 ≤ w 的路径个数: 题解: 昨天再打比赛的时候,中途,凯少和我说, ...

  3. 2019南昌邀请赛网络预选赛 I. Max answer(单调栈+暴力??)

    传送门 题意: 给你你一序列 a,共 n 个元素,求最大的F(l,r): F(l,r) = (a[l]+a[l+1]+.....+a[r])*min(l,r); ([l,r]的区间和*区间最小值,F( ...

  4. POJ-2796 & 2019南昌邀请赛网络赛 I. 区间最大min*sum

    http://poj.org/problem?id=2796 https://nanti.jisuanke.com/t/38228 背景 给定一个序列,对于任意区间,min表示区间中最小的数,sum表 ...

  5. 2019南昌邀请赛网络赛:J distance on the tree

    1000ms 262144K   DSM(Data Structure Master) once learned about tree when he was preparing for NOIP(N ...

  6. [2019南昌邀请赛网络赛D][dp]

    https://nanti.jisuanke.com/t/38223 Xiao Ming recently indulges in match stick game and he thinks he ...

  7. 2019南昌邀请赛预选赛 I. Max answer (前缀和+单调栈)

    题目:https://nanti.jisuanke.com/t/38228 这题题解参考网上大佬的. 程序的L[i],R[i]代表a[i]这个点的值在区间 [L[i],R[i]] 中最小的并且能拓展到 ...

  8. 2019南昌邀请赛 C. Angry FFF Party 大数矩阵快速幂+分类讨论

    题目链接 https://nanti.jisuanke.com/t/38222 题意: 定义函数: $$F(n)=\left\{\begin{aligned}1, \quad n=1,2 \\F(n- ...

  9. 南昌邀请赛网络赛 D.Match Stick Game(dp)

    南昌邀请赛网络赛 D.Match Stick Game 题目传送门 题目就会给你一个长度为n的字符串,其中\(1<n<100\).这个字符串是一个表达式,只有加减运算符,然后输入的每一个字 ...

随机推荐

  1. 页面中直接显示FTP中的图片

    页面中直接显示FTP中的图片 FTP根目录下有一张图片,如下 第一步: 通过如下格式,在浏览器上输入路径,确定可看到图片 ftp://root:root@127.0.0.1/111.png ftp:/ ...

  2. 【命令】Ubuntu设置和查看环境变量

    转自[Ubuntu]Ubuntu设置和查看环境变量 查看环境变量 env env命令是environment的缩写,用于列出所有的环境变量 export 单独使用export命令也可以像env列出所有 ...

  3. C语法简单测试

    1.未初始化的枚举变量 /* uninitialized-enum.c */ #include <stdio.h> , black, blue}; int main(void) { enu ...

  4. css实现标题左右横线

    最近用到了记录一下 页面 <div class="subtitle"> 马上邀请好友得奖励 </div> 样式 .subtitle { position: ...

  5. UML与软件建模:第二次作业(类图中类的表示)

    一.类图 (1)类图定义 类图,是UML(统一建模语言)中用于描述"类"以及"类与类"之间的示意图.它形象的描述出了系统的结构,帮助人们理解系统. 类图是在&q ...

  6. list练习

    usernames = ['cwl','pn','gxn','hyp']passwords = ['123456','abc123','324234','23423']#pn#sdfsdf #需要校验 ...

  7. 上传文件的三种方式xhr,ajax和iframe及上传预览

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. spring cloud config git库文件搜索顺序

    spring.cloud.config.server.git.uri只配置到仓库那一层就行了,需要访问仓库的子目录的话就配置spring.cloud.config.server.git.searchP ...

  9. 制作一个老旧C118的GSM便携式测试设备

    对于OsmocomBB也是被国内外大神玩得不亦乐乎.什么重定向攻击,中间人攻击.都是N年前的东西咯.当然鄙人不会这些.对于地下市场无非就是获取对方短信小则“老.虎.机”,大则支付宝.某日翻了翻“咸”鱼 ...

  10. Python 3 Anaconda 下爬虫学习与爬虫实践 (1)

    环境python 3 anaconda pip 以及各种库 1.requests库的使用 主要是如何获得一个网页信息 重点是 r=requests.get("https://www.goog ...