結果

問題 No.1381 Simple Geometry 1
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-02-07 20:51:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 9,040 KB
最終ジャッジ日時 2023-09-17 19:39:18
合計ジャッジ時間 2,298 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,784 KB
testcase_01 AC 21 ms
8,984 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 21 ms
9,028 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 24 ms
8,908 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
x, y, z, w = map(int, input().split())
d = make_divisors(x)
for i in d:
    oth = x // i
    if i < z or oth < y:
        continue
    try:
        if Decimal(str(y ** 2 + i ** 2)) ** Decimal("0.5") - Decimal(str(z ** 2 + oth ** 2)) ** Decimal("0.5") == Decimal(str(w)):
            print(x - y * i / 2 - z * oth / 2 - (i - z) * (oth - y) / 2)
            break
    except:
        continue
0