結果
問題 |
No.620 ぐるぐるぐるりん
|
ユーザー |
|
提出日時 | 2017-12-20 15:56:23 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 885 bytes |
コンパイル時間 | 3,240 ms |
コンパイル使用メモリ | 161,568 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:14:14 |
合計ジャッジ時間 | 4,755 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.complex; void main() { auto n = readln.chomp.to!int; foreach (_; 0..n) { auto rd = readln.splitter; auto t = rd.front.to!int; rd.popFront(); auto p = rd.front.to!real; rd.popFront(); auto w = rd.front.to!real; rd.popFront(); auto v = rd.front.to!real; rd.popFront(); auto gx = rd.front.to!real; rd.popFront(); auto gy = rd.front.to!real; rd.popFront(); calc(t, p, w, v, gx, gy); } } auto calc(int t, real p, real w, real v, real gx, real gy) { auto g = complex!real(gx, gy), e = complex!real(1+v, w); auto a = new Complex!real[](t); a[$-1] = 1; foreach_reverse (i; 0..t-1) a[i] = a[i+1] * e; auto b = g - a[0] * e; auto d = a.map!(ai => ai.sqAbs).sum; foreach (i; 0..t) { auto u = a[i].conj / d * b; writefln("%.15f %.15f", u.re, u.im); } }