結果

問題 No.2555 Intriguing Triangle
ユーザー coindarwcoindarw
提出日時 2023-12-01 23:28:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 947 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,736 KB
最終ジャッジ日時 2023-12-01 23:28:40
合計ジャッジ時間 7,147 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
88,200 KB
testcase_01 AC 165 ms
88,712 KB
testcase_02 AC 152 ms
88,456 KB
testcase_03 AC 195 ms
88,840 KB
testcase_04 AC 209 ms
89,096 KB
testcase_05 AC 130 ms
87,688 KB
testcase_06 AC 133 ms
88,200 KB
testcase_07 AC 137 ms
88,200 KB
testcase_08 AC 132 ms
87,688 KB
testcase_09 AC 171 ms
88,840 KB
testcase_10 AC 289 ms
89,224 KB
testcase_11 AC 177 ms
88,840 KB
testcase_12 AC 289 ms
89,736 KB
testcase_13 AC 208 ms
89,096 KB
testcase_14 AC 310 ms
89,736 KB
testcase_15 AC 155 ms
88,328 KB
testcase_16 AC 189 ms
88,968 KB
testcase_17 AC 132 ms
88,200 KB
testcase_18 AC 204 ms
89,096 KB
testcase_19 AC 144 ms
88,200 KB
testcase_20 AC 136 ms
87,688 KB
testcase_21 AC 419 ms
89,352 KB
testcase_22 AC 140 ms
88,200 KB
testcase_23 AC 133 ms
87,688 KB
testcase_24 AC 132 ms
87,688 KB
testcase_25 AC 131 ms
87,688 KB
testcase_26 AC 163 ms
88,328 KB
testcase_27 AC 192 ms
88,968 KB
testcase_28 AC 138 ms
88,200 KB
testcase_29 AC 188 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):
            Z = a + x + y
            if Z >= b + c or b >= Z + c or c >= Z + b:
                continue
            cosB = Fraction((Z**2 + b**2 - c**2), (2 * b * Z))
            cosC = Fraction((Z**2 + c**2 - b**2), (2 * c * Z))
            ss = Fraction(b**2 + x**2) - (2 * b * x * cosB)
            tt = Fraction(c**2 + y**2) - (2 * c * y * cosC)

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

            if (ss + b**2 - x**2) <= 0 or (tt + c**2 - y**2) <= 0:
                continue
            if cosP2 == 1 or cosQ2 == 1:
                continue

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


solve()
0