結果

問題 No.2555 Intriguing Triangle
ユーザー coindarwcoindarw
提出日時 2023-12-01 23:03:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,039 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,248 KB
最終ジャッジ日時 2023-12-01 23:04:02
合計ジャッジ時間 7,830 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
88,200 KB
testcase_01 WA -
testcase_02 AC 209 ms
88,968 KB
testcase_03 AC 186 ms
88,968 KB
testcase_04 AC 211 ms
89,096 KB
testcase_05 AC 137 ms
87,688 KB
testcase_06 AC 142 ms
88,200 KB
testcase_07 AC 151 ms
88,200 KB
testcase_08 AC 140 ms
87,688 KB
testcase_09 AC 185 ms
88,968 KB
testcase_10 AC 283 ms
89,864 KB
testcase_11 AC 183 ms
88,840 KB
testcase_12 AC 340 ms
90,248 KB
testcase_13 AC 261 ms
89,480 KB
testcase_14 AC 299 ms
89,992 KB
testcase_15 AC 167 ms
88,328 KB
testcase_16 AC 187 ms
89,096 KB
testcase_17 AC 143 ms
88,200 KB
testcase_18 AC 209 ms
88,968 KB
testcase_19 AC 141 ms
88,200 KB
testcase_20 AC 137 ms
87,688 KB
testcase_21 AC 436 ms
90,248 KB
testcase_22 AC 155 ms
88,456 KB
testcase_23 AC 154 ms
87,688 KB
testcase_24 AC 138 ms
87,688 KB
testcase_25 AC 140 ms
87,688 KB
testcase_26 AC 160 ms
88,328 KB
testcase_27 AC 179 ms
88,968 KB
testcase_28 AC 141 ms
88,200 KB
testcase_29 AC 220 ms
89,096 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(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) <= 0:
                continue
            if cosP2 == 1 or cosQ2 == 1:
                continue

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


solve()
0