QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#162374#5677. Clarissa's Conical CannolisJenniferLingAC ✓2ms4312kbC++20693b2023-09-03 11:23:022023-09-03 11:23:02

Judging History

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

  • [2023-09-03 11:23:02]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:4312kb
  • [2023-09-03 11:23:02]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define SZ(a) (int) a.size()
#define endl '\n'
#define X first
#define Y second

void solve(){
  double d, s, r, o;
  cin >> d >> s >> r >> o;
  const double pi = 3.14159265;
  double ang = sin(pi*d/2/s);
  if((s-r)*ang< r - o/2){
    cout << "-1.0\n";
    return;
  } 
  if(r*ang > r - o/2){
    cout << "-2.0\n";
    return;
  }
  cout << fixed << setprecision(1) << (ang*(s-r)+o/2.0-r)/ang << "\n";
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  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: 1ms
memory: 4212kb

input:

8.00 12.00 5.00 0.50

output:

1.5

result:

ok single line: '1.5'

Test #2:

score: 0
Accepted
time: 2ms
memory: 4144kb

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

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

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

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

input:

10.00 12.00 3.00 0.70

output:

-2.0

result:

ok single line: '-2.0'

Test #7:

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

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

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

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

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

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

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

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

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

input:

5.50 12.00 4.50 0.50

output:

1.1

result:

ok single line: '1.1'

Test #16:

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

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

input:

8.50 12.00 4.50 0.70

output:

2.9

result:

ok single line: '2.9'

Test #18:

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

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

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

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

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

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

input:

5.50 12.00 5.50 0.90

output:

-1.0

result:

ok single line: '-1.0'