結果

問題 No.2555 Intriguing Triangle
ユーザー coindarwcoindarw
提出日時 2023-12-01 22:37:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,120 KB
最終ジャッジ日時 2023-12-01 22:38:00
合計ジャッジ時間 6,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
88,200 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 134 ms
87,688 KB
testcase_06 AC 140 ms
88,200 KB
testcase_07 AC 143 ms
88,200 KB
testcase_08 AC 142 ms
87,688 KB
testcase_09 AC 141 ms
87,688 KB
testcase_10 AC 145 ms
87,688 KB
testcase_11 AC 176 ms
88,712 KB
testcase_12 AC 307 ms
90,120 KB
testcase_13 AC 148 ms
87,688 KB
testcase_14 AC 144 ms
87,688 KB
testcase_15 AC 162 ms
88,584 KB
testcase_16 AC 178 ms
88,840 KB
testcase_17 AC 142 ms
88,200 KB
testcase_18 WA -
testcase_19 AC 146 ms
88,200 KB
testcase_20 AC 172 ms
88,712 KB
testcase_21 AC 396 ms
90,120 KB
testcase_22 WA -
testcase_23 AC 140 ms
87,688 KB
testcase_24 AC 137 ms
87,688 KB
testcase_25 AC 142 ms
87,688 KB
testcase_26 AC 162 ms
88,584 KB
testcase_27 AC 170 ms
88,840 KB
testcase_28 AC 138 ms
88,200 KB
testcase_29 AC 209 ms
88,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from fractions import Fraction

rl = sys.stdin.readline

a = int(rl())
b = int(rl())
c = int(rl())


def solve():
    for x in range(1, 300):
        for y in range(2, 300):
            if x + y + a >= b + c:
                continue
            cosB = Fraction(
                ((x + y + a) * (x + y + a) + b * b - c * c), (2 * b * (x + y + a))
            )
            cosC = Fraction(
                ((x + y + a) * (x + y + a) + c * c - b * b), (2 * c * (x + y + a))
            )
            ss = Fraction(b * b + x * x) - (2 * b * x * cosB)
            tt = Fraction(c * c + y * y) - (2 * c * y * cosC)

            cosP2 = Fraction(ss + b * b - x * x) ** 2 / (4 * ss * b**2)
            cosQ2 = Fraction(tt + c * c - y * y) ** 2 / (4 * tt * c**2)

            if cosP2 == cosQ2:
                print("Yes")
                return
    print("No")


solve()
0