QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#99635#5461. Paddle Starwtz2333WA 122ms4088kbC++172.4kb2023-04-23 10:28:552023-04-23 10:28:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-23 10:28:59]
  • 评测
  • 测评结果:WA
  • 用时:122ms
  • 内存:4088kb
  • [2023-04-23 10:28:55]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
constexpr double eps = 1e-6;
constexpr double PI = acos(-1);
bool eq(double a, double b) { return abs(a - b) < eps; } // ==
bool gt(double a, double b) { return a - b > eps; }      // >
bool lt(double a, double b) { return a - b < -eps; }     // <
bool ge(double a, double b) { return a - b > -eps; }     // >=
bool le(double a, double b) { return a - b < eps; }      // <=

void solve(){
    int l1,l2,a,b;
    cin >> l1 >> l2 >> a >> b;
    double ans = 1.0 * (l1 + l2) * (l1 + l2) * PI * a / 180 + l2 * l2 * PI * b / 180;
    
    double A = PI * a / 180;

    double B = PI * b / 180;

    if(b <= 90){
        cout << fixed << setprecision(12) << ans << "\n";return ;
    }else {
        cout << fixed << setprecision(12);
        double l3 = sqrt(1.0 * l1 * l1 + 1.0 * l2 * l2 + 2 * l1 * l2 * cos(B));
        double R = asin(sin(B) * l2 / l3);
        double C = PI - (PI - B) - R;
        //cout  << 180 * C / PI << "\n";

        if(ge(2 * C,PI)){
            //cout << "aa";
            double s = l1 * l2 * sin(B);
            //cout << l3 << "\n";
            if(ge(2 * A,R)){
                s -= l3 * l3 * R;
                //cout << ans << "\n";
                ans += s;
                cout << ans << "\n";
            }else {
                double _C = PI - (PI - B) - 2 * A;
                double _l3 = l1 * sin(B) / sin(_C);
                ans += l1 * l3 * sin(R) - l3 * l3 * 2 * A - l3 * _l3 * sin(R - 2 * A);
                cout << ans << "\n"; 
            }
        }else{
            //cout << "bb";
            //cout  << 180 * C / PI << "\n";
        
            double _l2 = -l1 * cos(B);
            double _l3 = l1 * sin(B);
            double _R = B - (PI / 2);
            double s = _l2 *_l3;

            if(ge(2 * A,_R)){
                s -= _l3 * _l3 * _R;
                ans += s;
                cout << ans << "\n";
            }else {
                double _C = PI - (PI - B) - 2 * A;
                double __l3 = l1 * sin(B) / sin(_C);
                ans += l1 * _l3 * sin(_R) - _l3 * _l3 * 2 * A - _l3 * __l3 * sin(_R - 2 * A);
                cout << ans << "\n"; 
            }
        }
        
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T --){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 4068kb

input:

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

output:

3.490658503989
0.000000000000
3367.157611906510
1098.863278984082
373.960489570088

result:

ok 5 numbers

Test #2:

score: 0
Accepted
time: 122ms
memory: 4076kb

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.991613202876
13636.479265474325
19433.170502612673
61610.122595399836
17006.233726987324
15903.667036975090
37972.639843450066
13840.111902464634
14968.804520318268
9194.795925234086
31073.492936656643
16982.120743226402
12675.930420194696
36683.242951954220
658.687259702660
62718.197215759174
...

result:

ok 100000 numbers

Test #3:

score: -100
Wrong Answer
time: 90ms
memory: 4088kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0.000000000000
0.017453292520
0.034906585040
0.052359877560
0.069813170080
0.087266462600
0.104719755120
0.122173047640
0.139626340160
0.157079632679
0.174532925199
0.191986217719
0.209439510239
0.226892802759
0.244346095279
0.261799387799
0.279252680319
0.296705972839
0.314159265359
0.331612557879
...

result:

wrong answer 98281st numbers differ - expected: '3413722833360987136.0000000', found: '2581509702005301760.0000000', error = '0.2437846'