結果

問題 No.2352 Sharpened Knife in Fall
ユーザー FromBooskaFromBooska
提出日時 2023-06-17 11:27:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 518 ms / 3,000 ms
コード長 815 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 80,912 KB
最終ジャッジ日時 2023-09-07 08:36:50
合計ジャッジ時間 14,859 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,516 KB
testcase_01 AC 76 ms
70,980 KB
testcase_02 AC 77 ms
71,772 KB
testcase_03 AC 74 ms
71,168 KB
testcase_04 AC 518 ms
80,408 KB
testcase_05 AC 77 ms
71,092 KB
testcase_06 AC 513 ms
80,840 KB
testcase_07 AC 309 ms
79,400 KB
testcase_08 AC 512 ms
80,628 KB
testcase_09 AC 512 ms
80,852 KB
testcase_10 AC 515 ms
80,912 KB
testcase_11 AC 515 ms
80,824 KB
testcase_12 AC 510 ms
80,672 KB
testcase_13 AC 509 ms
80,756 KB
testcase_14 AC 296 ms
79,312 KB
testcase_15 AC 489 ms
80,752 KB
testcase_16 AC 126 ms
77,964 KB
testcase_17 AC 112 ms
77,052 KB
testcase_18 AC 249 ms
79,396 KB
testcase_19 AC 425 ms
80,304 KB
testcase_20 AC 233 ms
79,016 KB
testcase_21 AC 224 ms
78,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 円の上半分でy座標を求めて、あとはミラーで下半分作る
# Kが奇数ならy=0が含まれる
# 二分探索で求めるか
# あるyで切ったときの上のケーキの面積は
# S = theta*R**2 - y*R*sintheta where theta = arccos(y/R)

R, K = map(int, input().split())

import math

def calc_area(y):
    theta = math.acos(y/R)
    area = theta*(R**2) - y*R*math.sin(theta)
    return area

ans_list = []
if K%2 == 1:
    ans_list.append(0)
for k in range(K//2):
    find = math.pi*(R**2)*((k+1)/(K+1))
    OK = R
    NG = 0
    for i in range(100):
        mid = (OK+NG)/2
        if calc_area(mid) <= find:
            OK = mid
        else:
            NG = mid
    ans_list.append(OK)
    ans_list.append(-OK)
    
ans_list.sort()
#print(ans_list)

for a in ans_list:
    print(a)



0