QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#648163#5461. Paddle StarRepeater#WA 87ms4268kbC++201.3kb2024-10-17 17:24:132024-10-17 17:24:15

Judging History

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

  • [2024-10-17 17:24:15]
  • 评测
  • 测评结果:WA
  • 用时:87ms
  • 内存:4268kb
  • [2024-10-17 17:24:13]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define int long long

using db = long double;

const db pi = acosl(-1.0L);

void solve(){
	int l, r, a, b;
	cin >> l >> r >> a >> b;

	db x = pi * a / 180;
	db y = pi * b / 180;
	db ans = x * ((l + r) * (l + r)) + y * r * r;

	if(b > 90){
		if(sinl(y - pi / 2) * l <= r){
			ans += sinl(y - pi / 2) * l * cosl(y - pi / 2) * l;
			ans -= (y - pi / 2) * cosl(y - pi / 2) * l * cosl(y - pi / 2) * l;
			if(y - pi / 2 > x + x){
				db z = y - pi / 2 - x - x;
				db len = cosl(y - pi / 2) * l;
				ans -= tanl(z) * len * len;
				ans += z * len * len;
			}
		}else{
			ans += sinl(y) * l * r;
			db d = sinl(y) * r * sinl(y) * r + (l - r * cosl(pi - y)) * (l - r * cosl(pi - y));
			ans -= atanl((sinl(y) * r) / (l - r * cosl(pi - y))) * d;
			if(atanl((sinl(y) * r) / (l - r * cosl(pi - y))) > x + x){
				db z = atanl((sinl(y) * r) / (l - r * cosl(pi - y))) - x - x;
				ans -= tanl(z) * d;
				ans += z * d;
			}
		}
	}

	cout << ans << "\n";
	return;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	cout << fixed << setprecision(20);

	int t; cin >> t;
	while(t--) solve();

	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4268kb

input:

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

output:

3.49065850398865915385
0.00000000000000000000
3367.15761190651085499326
1098.86327898408187730972
373.96048957008772231636

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 87ms
memory: 4148kb

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.99161320287554799435
13636.47926547432505994806
19433.17050261267052135850
61610.12259539983406497754
17006.23372698732650398767
15903.66703697509036707913
37972.63984345007019527429
13840.11190246463467978799
14968.80452031827099723671
9194.79592523408690674103
31073.49293665664492181122
16982...

result:

wrong answer 31st numbers differ - expected: '12961.4718368', found: '12988.3103186', error = '0.0020706'