結果

問題 No.2352 Sharpened Knife in Fall
ユーザー とりゐとりゐ
提出日時 2023-06-16 22:20:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 853 ms / 3,000 ms
コード長 533 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 79,172 KB
最終ジャッジ日時 2023-09-06 20:30:09
合計ジャッジ時間 19,916 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,920 KB
testcase_01 AC 72 ms
71,616 KB
testcase_02 AC 73 ms
71,672 KB
testcase_03 AC 72 ms
71,648 KB
testcase_04 AC 781 ms
78,264 KB
testcase_05 AC 68 ms
71,660 KB
testcase_06 AC 839 ms
78,836 KB
testcase_07 AC 479 ms
78,476 KB
testcase_08 AC 843 ms
79,172 KB
testcase_09 AC 853 ms
78,876 KB
testcase_10 AC 852 ms
79,064 KB
testcase_11 AC 839 ms
78,748 KB
testcase_12 AC 849 ms
79,068 KB
testcase_13 AC 835 ms
78,812 KB
testcase_14 AC 460 ms
78,544 KB
testcase_15 AC 801 ms
78,468 KB
testcase_16 AC 144 ms
78,124 KB
testcase_17 AC 130 ms
78,384 KB
testcase_18 AC 374 ms
78,248 KB
testcase_19 AC 690 ms
78,308 KB
testcase_20 AC 329 ms
78,420 KB
testcase_21 AC 321 ms
78,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
r,k=map(int,input().split())
S=r*r*math.pi

eps=1e-9
def calc(y):
  if y<-r+eps:
    return 0
  if y>r-eps:
    return S
  if abs(y)<eps:
    return S/2
  if y>0:
    rad=math.asin(y/r)
    res=r*r*rad+y*math.cos(rad)*r
    return S/2+res
  else:
    y=abs(y)
    rad=math.asin(y/r)
    res=r*r*rad+y*math.cos(rad)*r
    return S/2-res

res=[]
for i in range(1,k+1):
  s=S/(k+1)*i
  ng,ok=-r,r
  for _ in range(100):
    mid=(ng+ok)/2
    if calc(mid)>=s:
      ok=mid
    else:
      ng=mid
  print('{:.20f}'.format(ok))
0