結果
| 問題 |
No.2555 Intriguing Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-01 23:28:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 446 ms / 2,000 ms |
| コード長 | 947 bytes |
| コンパイル時間 | 430 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 90,752 KB |
| 最終ジャッジ日時 | 2024-09-26 15:59:57 |
| 合計ジャッジ時間 | 7,723 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
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()