QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#180988#5677. Clarissa's Conical CannolisYshanqianAC ✓1ms4160kbC++141.1kb2023-09-16 14:54:422023-09-16 14:54:42

Judging History

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

  • [2023-09-16 14:54:42]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4160kb
  • [2023-09-16 14:54:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define xx first
#define yy second
#define endl "\n"
#define lowbit(x) x & (-x)
#define int long long
#define ull unsigned long long
#define pb push_back
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define Ysanqian ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int N = 1e6 + 10, M = 1010, inf = 0x3f3f3f3f, mod = 18446, P = 13331;
const double eps = 1e-8;
double d, s, r, o;
void solve()
{
  cin >> d >> s >> r >> o;
  double angle = pi * d / s; // 扇形角r/l*360
  angle /= 2;
  o /= 2;
  if ((s - r) * sin(angle) - r < o) // 放在最下面都多了
    cout << "-1.0" << endl;
  else if (r - (r * sin(angle)) < o) // 放在最上面都不够
    cout << "-2.0" << endl;
  else
  {
    double h = (r - o) / sin(angle);
    printf("%.1lf", s - h - r);
  }
}
signed main()
{
  Ysanqian;
  int T;
  T = 1;
  // cin >> T;
  while (T--)
    solve();
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4052kb

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

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

input:

11.00 12.00 5.00 0.50

output:

-2.0

result:

ok single line: '-2.0'

Test #4:

score: 0
Accepted
time: 1ms
memory: 4004kb

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

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

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

input:

5.50 12.00 3.50 0.30

output:

3.4

result:

ok single line: '3.4'

Test #8:

score: 0
Accepted
time: 1ms
memory: 4100kb

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

input:

8.50 12.00 3.50 0.70

output:

5.0

result:

ok single line: '5.0'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

10.00 12.00 3.50 0.30

output:

-2.0

result:

ok single line: '-2.0'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

5.50 12.00 4.00 0.70

output:

2.5

result:

ok single line: '2.5'

Test #12:

score: 0
Accepted
time: 1ms
memory: 4016kb

input:

7.00 12.00 4.00 0.90

output:

3.5

result:

ok single line: '3.5'

Test #13:

score: 0
Accepted
time: 1ms
memory: 4064kb

input:

8.50 12.00 4.00 0.50

output:

3.8

result:

ok single line: '3.8'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

10.00 12.00 4.00 0.30

output:

-2.0

result:

ok single line: '-2.0'

Test #15:

score: 0
Accepted
time: 1ms
memory: 4132kb

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

input:

7.00 12.00 4.50 0.50

output:

2.1

result:

ok single line: '2.1'

Test #17:

score: 0
Accepted
time: 1ms
memory: 4160kb

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

input:

10.00 12.00 4.50 0.50

output:

-2.0

result:

ok single line: '-2.0'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3936kb

input:

5.50 12.00 5.00 0.30

output:

-1.0

result:

ok single line: '-1.0'

Test #20:

score: 0
Accepted
time: 1ms
memory: 3940kb

input:

7.00 12.00 5.00 0.90

output:

1.3

result:

ok single line: '1.3'

Test #21:

score: 0
Accepted
time: 1ms
memory: 4156kb

input:

8.50 12.00 5.00 0.70

output:

1.8

result:

ok single line: '1.8'

Test #22:

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

input:

10.00 12.00 5.00 0.30

output:

2.0

result:

ok single line: '2.0'

Test #23:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

5.50 12.00 5.50 0.90

output:

-1.0

result:

ok single line: '-1.0'