結果

問題 No.620 ぐるぐるぐるりん
ユーザー maspymaspy
提出日時 2020-05-03 12:46:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 933 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 8,340 KB
最終ジャッジ日時 2023-09-02 12:58:35
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,792 KB
testcase_01 AC 16 ms
7,940 KB
testcase_02 AC 17 ms
7,792 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 16 ms
7,832 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 15 ms
7,856 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 15 ms
7,812 KB
testcase_09 AC 15 ms
7,852 KB
testcase_10 AC 15 ms
7,792 KB
testcase_11 AC 16 ms
7,752 KB
testcase_12 AC 15 ms
7,812 KB
testcase_13 AC 16 ms
7,756 KB
testcase_14 AC 16 ms
7,824 KB
testcase_15 AC 15 ms
7,824 KB
testcase_16 AC 15 ms
7,824 KB
testcase_17 AC 16 ms
7,860 KB
testcase_18 AC 16 ms
7,736 KB
testcase_19 AC 16 ms
7,904 KB
testcase_20 AC 16 ms
7,748 KB
testcase_21 AC 15 ms
7,828 KB
testcase_22 AC 16 ms
7,744 KB
testcase_23 AC 16 ms
7,896 KB
testcase_24 AC 15 ms
7,880 KB
testcase_25 AC 16 ms
7,744 KB
testcase_26 AC 46 ms
8,236 KB
testcase_27 AC 16 ms
7,792 KB
testcase_28 AC 46 ms
8,340 KB
testcase_29 AC 46 ms
8,332 KB
testcase_30 AC 46 ms
8,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def solve(T, p, w, v, gx, gy):
    T = int(T)
    p, w, v, gx, gy = map(float, (p, w, v, gx, gy))
    r = complex(1 + v, w)
    power = [r**i for i in range(T + 1)]
    g = complex(gx, gy) - power[T]
    c = 1 / sum(abs(z) ** 2 for z in power[:T])
    for i in range(T):
        a = c * g * power[T-1-i].conjugate()
        yield (a.real, a.imag)

"""
def check(p, w, v, gx, gy, uvs):
    z = 1
    r = complex(1 + v, w)
    for dx, dy in uvs:
        z *= r
        z += complex(dx, dy)
        p -= dx**2 + dy**2
    return abs(z - complex(gx, gy)) < 1e-6 and p > 0


uvs = ((1, 0), (1, 0), (1, 0), (0, 1), (0, 1))
check(5.5, 0.5, -0.5, -1.125, 2.125, uvs)
"""

N = int(readline())
probs = readlines()

for prob in probs:
    uvs = solve(*prob.split())
    print('\n'.join('{} {}'.format(x, y) for x, y in uvs))

0