QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103396 | #5677. Clarissa's Conical Cannolis | Nicolas125841 | AC ✓ | 378ms | 4196kb | C++14 | 992b | 2023-05-05 17:24:03 | 2023-05-05 17:24:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main(){
double d, s, r, o;
cin >> d >> s >> r >> o;
bool tl = false, ts = false, jr = false;
double mx = -10.0;
for(double i = 0.0; i <= 2.0*r; i += 0.001)
mx = max(mx, 2.0*i*acos(i/(2.0*r)) - PI*i*d/s);
if(mx - o <= -0.01){
cout << "-2.0\n";
return 0;
}else if(mx - o < 0.01){
cout << "0.0\n";
return 0;
}
for(double i = 0.001; i <= s - 2.0*r; i += 0.001){
tl = false, ts = false, jr = false;
mx = -10.0;
for(double j = 0; j <= 2.0*r; j += 0.001)
mx = max(mx, 2.0*(j+i)*acos(((i+j)*(i+j) - r*r + (r+i)*(r+i))/(2*(r+i)*(i+j))) - PI*(j+i)*d/s);
if(mx - o < 0.01 && mx - o > -0.01){
cout << setprecision(1) << fixed << (s - i - 2.0*r) << "\n";
return 0;
}
}
cout << "-1.0\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 89ms
memory: 4048kb
input:
8.00 12.00 5.00 0.50
output:
1.5
result:
ok single line: '1.5'
Test #2:
score: 0
Accepted
time: 377ms
memory: 3944kb
input:
5.00 12.00 5.00 0.50
output:
-1.0
result:
ok single line: '-1.0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3952kb
input:
11.00 12.00 5.00 0.50
output:
-2.0
result:
ok single line: '-2.0'
Test #4:
score: 0
Accepted
time: 25ms
memory: 3984kb
input:
7.00 12.00 3.00 0.90
output:
5.8
result:
ok single line: '5.8'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3924kb
input:
8.50 12.00 3.00 0.90
output:
-2.0
result:
ok single line: '-2.0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
10.00 12.00 3.00 0.70
output:
-2.0
result:
ok single line: '-2.0'
Test #7:
score: 0
Accepted
time: 209ms
memory: 4064kb
input:
5.50 12.00 3.50 0.30
output:
3.4
result:
ok single line: '3.4'
Test #8:
score: 0
Accepted
time: 64ms
memory: 4196kb
input:
7.00 12.00 3.50 0.70
output:
4.5
result:
ok single line: '4.5'
Test #9:
score: 0
Accepted
time: 1ms
memory: 4140kb
input:
8.50 12.00 3.50 0.70
output:
5.0
result:
ok single line: '5.0'
Test #10:
score: 0
Accepted
time: 2ms
memory: 4000kb
input:
10.00 12.00 3.50 0.30
output:
-2.0
result:
ok single line: '-2.0'
Test #11:
score: 0
Accepted
time: 234ms
memory: 4064kb
input:
5.50 12.00 4.00 0.70
output:
2.5
result:
ok single line: '2.5'
Test #12:
score: 0
Accepted
time: 72ms
memory: 4192kb
input:
7.00 12.00 4.00 0.90
output:
3.5
result:
ok single line: '3.5'
Test #13:
score: 0
Accepted
time: 24ms
memory: 4076kb
input:
8.50 12.00 4.00 0.50
output:
3.8
result:
ok single line: '3.8'
Test #14:
score: 0
Accepted
time: 2ms
memory: 4040kb
input:
10.00 12.00 4.00 0.30
output:
-2.0
result:
ok single line: '-2.0'
Test #15:
score: 0
Accepted
time: 338ms
memory: 4076kb
input:
5.50 12.00 4.50 0.50
output:
1.1
result:
ok single line: '1.1'
Test #16:
score: 0
Accepted
time: 138ms
memory: 4136kb
input:
7.00 12.00 4.50 0.50
output:
2.1
result:
ok single line: '2.1'
Test #17:
score: 0
Accepted
time: 19ms
memory: 4136kb
input:
8.50 12.00 4.50 0.70
output:
2.9
result:
ok single line: '2.9'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3948kb
input:
10.00 12.00 4.50 0.50
output:
-2.0
result:
ok single line: '-2.0'
Test #19:
score: 0
Accepted
time: 378ms
memory: 4064kb
input:
5.50 12.00 5.00 0.30
output:
-1.0
result:
ok single line: '-1.0'
Test #20:
score: 0
Accepted
time: 131ms
memory: 4096kb
input:
7.00 12.00 5.00 0.90
output:
1.3
result:
ok single line: '1.3'
Test #21:
score: 0
Accepted
time: 35ms
memory: 4100kb
input:
8.50 12.00 5.00 0.70
output:
1.8
result:
ok single line: '1.8'
Test #22:
score: 0
Accepted
time: 5ms
memory: 4136kb
input:
10.00 12.00 5.00 0.30
output:
2.0
result:
ok single line: '2.0'
Test #23:
score: 0
Accepted
time: 205ms
memory: 3900kb
input:
5.50 12.00 5.50 0.90
output:
-1.0
result:
ok single line: '-1.0'