QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#181081#5677. Clarissa's Conical Cannoliswdbl857AC ✓0ms4356kbC++20888b2023-09-16 15:39:392023-09-16 15:39:39

Judging History

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

  • [2023-09-16 15:39:39]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:4356kb
  • [2023-09-16 15:39:39]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define int long long
#define ULL unsigned long long
#define endl "\n"
#define pi acos(-1)
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;
const int N = 1e6 + 10, M = 1010, INF = 0x3f3f3f3f, mod = 998244353;

void solve()
{
    double d, s, r, o;
    cin >> d >> s >> r >> o;
    double A = d * pi / s;
    // cout << A * 180 / pi << endl;
    // cout << cos(A) << endl;
    if ((s - r) * sin(A / 2) - r < o / 2)
        cout << "-1.0" << endl;
    else if (r - (r * sin(A / 2)) < o / 2)
        cout << "-2.0" << endl;
    else
    {
        double dis = s - (r - o / 2) / sin(A / 2) - r;
        printf("%.1lf\n", dis);
    }
}
signed main()
{
    ios;
    int T = 1;
    // cin >> T;
    while (T--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

8.00 12.00 5.00 0.50

output:

1.5

result:

ok single line: '1.5'

Test #2:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

5.00 12.00 5.00 0.50

output:

-1.0

result:

ok single line: '-1.0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

11.00 12.00 5.00 0.50

output:

-2.0

result:

ok single line: '-2.0'

Test #4:

score: 0
Accepted
time: 0ms
memory: 4276kb

input:

7.00 12.00 3.00 0.90

output:

5.8

result:

ok single line: '5.8'

Test #5:

score: 0
Accepted
time: 0ms
memory: 4108kb

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: 4112kb

input:

10.00 12.00 3.00 0.70

output:

-2.0

result:

ok single line: '-2.0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 4192kb

input:

5.50 12.00 3.50 0.30

output:

3.4

result:

ok single line: '3.4'

Test #8:

score: 0
Accepted
time: 0ms
memory: 4192kb

input:

7.00 12.00 3.50 0.70

output:

4.5

result:

ok single line: '4.5'

Test #9:

score: 0
Accepted
time: 0ms
memory: 4188kb

input:

8.50 12.00 3.50 0.70

output:

5.0

result:

ok single line: '5.0'

Test #10:

score: 0
Accepted
time: 0ms
memory: 4164kb

input:

10.00 12.00 3.50 0.30

output:

-2.0

result:

ok single line: '-2.0'

Test #11:

score: 0
Accepted
time: 0ms
memory: 4168kb

input:

5.50 12.00 4.00 0.70

output:

2.5

result:

ok single line: '2.5'

Test #12:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

7.00 12.00 4.00 0.90

output:

3.5

result:

ok single line: '3.5'

Test #13:

score: 0
Accepted
time: 0ms
memory: 4280kb

input:

8.50 12.00 4.00 0.50

output:

3.8

result:

ok single line: '3.8'

Test #14:

score: 0
Accepted
time: 0ms
memory: 4192kb

input:

10.00 12.00 4.00 0.30

output:

-2.0

result:

ok single line: '-2.0'

Test #15:

score: 0
Accepted
time: 0ms
memory: 4192kb

input:

5.50 12.00 4.50 0.50

output:

1.1

result:

ok single line: '1.1'

Test #16:

score: 0
Accepted
time: 0ms
memory: 4280kb

input:

7.00 12.00 4.50 0.50

output:

2.1

result:

ok single line: '2.1'

Test #17:

score: 0
Accepted
time: 0ms
memory: 4228kb

input:

8.50 12.00 4.50 0.70

output:

2.9

result:

ok single line: '2.9'

Test #18:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

10.00 12.00 4.50 0.50

output:

-2.0

result:

ok single line: '-2.0'

Test #19:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

5.50 12.00 5.00 0.30

output:

-1.0

result:

ok single line: '-1.0'

Test #20:

score: 0
Accepted
time: 0ms
memory: 4356kb

input:

7.00 12.00 5.00 0.90

output:

1.3

result:

ok single line: '1.3'

Test #21:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

8.50 12.00 5.00 0.70

output:

1.8

result:

ok single line: '1.8'

Test #22:

score: 0
Accepted
time: 0ms
memory: 4356kb

input:

10.00 12.00 5.00 0.30

output:

2.0

result:

ok single line: '2.0'

Test #23:

score: 0
Accepted
time: 0ms
memory: 4164kb

input:

5.50 12.00 5.50 0.90

output:

-1.0

result:

ok single line: '-1.0'