結果

問題 No.2555 Intriguing Triangle
ユーザー coindarwcoindarw
提出日時 2023-12-01 23:01:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 89,992 KB
最終ジャッジ日時 2023-12-01 23:01:53
合計ジャッジ時間 8,653 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
88,200 KB
testcase_01 AC 191 ms
88,968 KB
testcase_02 AC 212 ms
88,968 KB
testcase_03 AC 183 ms
88,968 KB
testcase_04 AC 206 ms
89,096 KB
testcase_05 WA -
testcase_06 AC 137 ms
88,200 KB
testcase_07 AC 146 ms
88,200 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 144 ms
88,200 KB
testcase_18 AC 211 ms
89,096 KB
testcase_19 AC 143 ms
88,200 KB
testcase_20 WA -
testcase_21 AC 438 ms
89,736 KB
testcase_22 AC 147 ms
88,456 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 139 ms
88,200 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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(1, 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 (ss + b * b - x * x) <= 0 or (tt + c * c - y * y):
                continue

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


solve()
0