时限:
1s
Description
Input
Output
Sample Input
输入1:
0 90 100
-20 10 20 10
输入2:
1 120 15
-5 5 0 5 0
-20 10 20 10
输入3:
2 150.0000 1000.0000
-60 165 50 165 0
110 25 130 120 1
-205 360 275 360
#
输出1:
0.5000
输出2:
0.3090
输出3:
0.7443
样例3解释:
Data Constraint
题解:
把整束光拆成若干条光线,模拟每条光线的路径,求出它们照到屏幕上的哪里,如果屏幕上有一部分被光线密集的覆盖,我们就认为光能照到这一篇区域。
有多密呢?注意答案的要求,我们可以设定为屏幕长度×10^-4。
那要拆多少条呢。用一个技巧,能拆多少拆多少,可惜的是,这道题这样子不会过。
我们可以先拆数量较少的光线,如果两条相邻的光线照在屏幕上的位置不连续,则说明它们中间有改变,再把它们中间拆多几条光线,就可以通过此题。
其实说了这么多技巧都是没有用的,重在卡。
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define LLd long double
#define PI 3.1415926535897932384626433
#define abs(a) ((a) > 0 ? (a) : -(a))
#define fo(i, x, y) for(int i = x; i <= y; i ++)
#define hu(a) (a * PI / 180)
#define inn(a, b, c) ((a >= b && a <= c) || (a >= c && a <= b))
using namespace std;
struct pi {
LLd x, y;
pi(){}
pi(LLd x_, LLd y_){
x = x_, y = y_;}
};
struct ld {
pi p, v