結果
| 問題 |
No.620 ぐるぐるぐるりん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-20 15:45:16 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 1,000 ms |
| コード長 | 851 bytes |
| コンパイル時間 | 3,143 ms |
| コンパイル使用メモリ | 164,492 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 23:14:01 |
| 合計ジャッジ時間 | 5,153 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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(gx, gy), e = complex(1+v, w);
auto b = g - e ^^ t;
auto a = new Complex!real[](t);
foreach (i; 0..t) a[i] = e ^^ (t-i-1);
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);
}
}