QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#175302#5461. Paddle StarrealIyxiang#TL 1ms4088kbC++141.0kb2023-09-10 17:21:002023-09-10 17:21:00

Judging History

你现在查看的是最新测评结果

  • [2023-09-10 17:21:00]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:4088kb
  • [2023-09-10 17:21:00]
  • 提交

answer

#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const double pi=acos(-1.0);
double f(double a){
	double b=a*pi/180;
	return b;
}
int main(){
  int T; 
  cin >> T;
  while (T--) {
    double l,i,a,b;
    cin>>l;cin>>i;cin>>a;cin>>b;// printf("%.10lf\n", f(b)); 
    
    double s=(f(a)*(l+i)*(l+i)+f(b)*i*i);
    
    double r=sqrt(l*l+i*i+l*i*2*cos(f(b)));// printf("%.10lf\n", r); 
    double x=acos((i*i+r*r-l*l)/(2*i*r)); // printf("%.10lf\n", x); 
    double q=acos((l*l+r*r-i*i)/(2*l*r));// printf("%.10lf\n", q); 
    double c;
    if(b<=90.0){
      c=0;
    }
    else if(x>=pi/2){
      c=l*i*sin(f(b))-q*r*r;
    }
    else{
      c=-l*l*sin(f(b))*cos(f(b))-l*l*sin(f(b))*sin(f(b))*f(b-90);// printf("%.10lf\n", f(b-90)); 
      double h=l*sin(f(b));// printf("%.10lf\n",  h); 
      double u=f(max(b-90-2*a,0.0));// printf("%.10lf\n",  u); 
      c=c-h*h*tan(u)+h*h*u; 
    }
    // printf("%.10lf\n",  c); 
    printf("%.15lf\n", s + c); 
  }
	return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4088kb

input:

5
2 1 20 20
3 3 0 0
20 20 90 120
20 10 50 170
100 10 1 93

output:

3.490658503988659
0.000000000000000
3367.157611906510283
1098.863278984081717
373.960489570087816

result:

ok 5 numbers

Test #2:

score: -100
Time Limit Exceeded

input:

100000
88 12 24 116
79 15 84 150
96 52 31 141
100 100 81 29
83 29 71 99
95 92 5 87
99 97 39 72
79 72 20 65
67 39 60 116
100 89 1 62
78 77 63 45
62 34 83 178
92 49 24 103
94 73 66 49
20 14 24 51
100 97 66 109
94 94 86 82
82 79 49 67
76 38 88 118
92 79 58 112
93 23 40 167
87 34 13 25
96 18 73 15
94 38...

output:

4526.991613202873850
13636.479265474323256
19433.170502612669225
61610.122595399836428
17006.233726987324189
15903.667036975090014
37972.639843450066110
13840.111902464634113
14968.804520318271898
9194.795925234087917
31073.492936656646634
16982.120743226401828
12675.930420194697945
36683.2429519542...

result: