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