QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103395 | #5677. Clarissa's Conical Cannolis | Nicolas125841 | WA | 4ms | 4124kb | C++14 | 988b | 2023-05-05 17:22:03 | 2023-05-05 17:22: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.01)
mx = max(mx, 2.0*i*acos(i/(2.0*r)) - PI*i*d/s);
if(mx - o < -0.05){
cout << "-2.0\n";
return 0;
}else if(mx - o <= 0.05){
cout << "0.0\n";
return 0;
}
for(double i = 0.01; i <= s - 2.0*r; i += 0.01){
tl = false, ts = false, jr = false;
mx = -10.0;
for(double j = 0; j <= 2.0*r; j += 0.01)
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.05 && mx - o > -0.05){
cout << setprecision(1) << fixed << (s - i - 2.0*r) << "\n";
return 0;
}
}
cout << "-1.0\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 4124kb
input:
8.00 12.00 5.00 0.50
output:
1.5
result:
ok single line: '1.5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3952kb
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: 3944kb
input:
11.00 12.00 5.00 0.50
output:
-2.0
result:
ok single line: '-2.0'
Test #4:
score: 0
Accepted
time: 2ms
memory: 4040kb
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: 3816kb
input:
8.50 12.00 3.00 0.90
output:
-2.0
result:
ok single line: '-2.0'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
10.00 12.00 3.00 0.70
output:
-2.0
result:
ok single line: '-2.0'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3948kb
input:
5.50 12.00 3.50 0.30
output:
3.4
result:
ok single line: '3.4'
Test #8:
score: 0
Accepted
time: 2ms
memory: 4048kb
input:
7.00 12.00 3.50 0.70
output:
4.5
result:
ok single line: '4.5'
Test #9:
score: -100
Wrong Answer
time: 2ms
memory: 3948kb
input:
8.50 12.00 3.50 0.70
output:
0.0
result:
wrong answer 1st lines differ - expected: '5.0', found: '0.0'