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