結果
問題 |
No.3180 angles sum
|
ユーザー |
|
提出日時 | 2025-06-13 22:46:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,007 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 235,512 KB |
最終ジャッジ日時 | 2025-06-14 01:43:31 |
合計ジャッジ時間 | 5,749 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 WA * 1 |
ソースコード
import sys def main(): data = sys.stdin.read().split() ints = [] for tok in data: try: ints.append(int(tok)) except ValueError: # skip non-integer tokens, e.g. "CASE" continue if not ints: return T = ints[0] out = [] idx = 1 for _ in range(T): Ax, Ay, Bx, By, Cx, Cy = ints[idx:idx+6] idx += 6 # tan(α + β) = (tan α + tan β) / (1 - tan α tan β) # Let tan α = Ay/Ax, tan β = By/Bx. # Numerator a = Ay*Bx + Ax*By # Denominator b = Ax*Bx - Ay*By # We want tan(α+β) == Cy/Cx <=> a/b == Cy/Cx # Cross-multiply (be careful if b==0 or Cx==0; this formula still works): a = Ay * Bx + Ax * By b = Ax * Bx - Ay * By # Check a * Cx == b * Cy if a * Cx == b * Cy: out.append("Yes") else: out.append("No") sys.stdout.write("\n".join(out)) if __name__ == "__main__": main()