結果

問題 No.3437 [Cherry 8th Tune C] Silhouette
コンテスト
ユーザー 👑 Kazun
提出日時 2024-05-06 22:51:37
言語 PyPy3
(7.3.17)
結果
WA  
実行時間 -
コード長 944 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 507 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 83,736 KB
最終ジャッジ日時 2026-01-23 20:51:20
合計ジャッジ時間 5,659 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def point_shadow(Z, P):
    # 点光源 (0, 0, Z) における点 P の xy 平面への影の座標の x 成分, y 成分を求める.

    A, B, C = P
    return (Z * A) / (Z - C), (Z * B) / (Z - C)

def triangle_area(U, V, W):
    # 三角形 UVW の面積を求める.

    UVx = V[0] - U[0]; UVy = V[1] - U[1]
    UWx = W[0] - U[0]; UWy = W[1] - U[1]
    return abs(UVx * UWy - UVy * UWx) / 2

def solve():
    triangle = [list(map(int, input().split())) for _ in range(3)]
    X, Y, Z = map(int, input().split())

    # 平行移動
    for point in triangle:
        point[0] -= X
        point[1] -= Y

    # 影を求める.
    shadows = [ point_shadow(Z, point) for point in triangle]

    # 面積を返す.
    return triangle_area(*shadows)

#==================================================
import sys
input = sys.stdin.readline
write = sys.stdout.write

T = int(input())
write("\n".join(map(str, [solve() for _ in range(T)])))
0