結果

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

ソースコード

diff #
raw source code

# 解答生成用

def point_shadow(Z, P):
    A, B, C = P
    return Fraction(Z * A, Z - C), Fraction(Z * B, Z - C)

def triangle_area(U, V, W):
    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

    S = triangle_area(*[point_shadow(Z, point) for point in triangle])
    return S.numerator * pow(S.denominator, -1, Mod) % Mod

#==================================================
from fractions import Fraction

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

Mod = 998244353

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