結果
問題 | No.620 ぐるぐるぐるりん |
ユーザー | 夕叢霧香(ゆうむらきりか) |
提出日時 | 2017-12-21 15:27:03 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 268 ms / 1,000 ms |
コード長 | 2,890 bytes |
コンパイル時間 | 2,708 ms |
コンパイル使用メモリ | 79,884 KB |
実行使用メモリ | 47,252 KB |
最終ジャッジ日時 | 2024-06-13 02:09:22 |
合計ジャッジ時間 | 7,998 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 90 ms
40,520 KB |
testcase_01 | AC | 92 ms
40,516 KB |
testcase_02 | AC | 94 ms
40,492 KB |
testcase_03 | AC | 91 ms
40,160 KB |
testcase_04 | AC | 86 ms
38,848 KB |
testcase_05 | AC | 89 ms
40,496 KB |
testcase_06 | AC | 88 ms
40,484 KB |
testcase_07 | AC | 86 ms
38,844 KB |
testcase_08 | AC | 90 ms
40,400 KB |
testcase_09 | AC | 92 ms
40,320 KB |
testcase_10 | AC | 98 ms
40,388 KB |
testcase_11 | AC | 89 ms
40,636 KB |
testcase_12 | AC | 84 ms
38,824 KB |
testcase_13 | AC | 86 ms
38,656 KB |
testcase_14 | AC | 95 ms
38,672 KB |
testcase_15 | AC | 87 ms
38,464 KB |
testcase_16 | AC | 90 ms
40,320 KB |
testcase_17 | AC | 91 ms
40,756 KB |
testcase_18 | AC | 87 ms
38,856 KB |
testcase_19 | AC | 94 ms
40,332 KB |
testcase_20 | AC | 90 ms
38,688 KB |
testcase_21 | AC | 90 ms
40,380 KB |
testcase_22 | AC | 90 ms
38,528 KB |
testcase_23 | AC | 93 ms
40,260 KB |
testcase_24 | AC | 89 ms
38,656 KB |
testcase_25 | AC | 92 ms
38,516 KB |
testcase_26 | AC | 267 ms
47,088 KB |
testcase_27 | AC | 90 ms
38,864 KB |
testcase_28 | AC | 264 ms
47,136 KB |
testcase_29 | AC | 268 ms
47,100 KB |
testcase_30 | AC | 259 ms
47,252 KB |
ソースコード
import java.io.*;import java.util.*;final class C{double x,y;C(double x,double y){this.x=x;this.y=y;}C mul(C o){return new C(x*o.x-y*o.y,x*o.y+y*o.x);}C sub(C o){return new C(x-o.x,y-o.y);}C add(C o){return new C(x+o.x,y+o.y);}C conj(){return new C(x,-y);}double sq(){return x*x+y*y;}}class Main {static void solve(int t,double p,double omega,double v,double gx,double gy){C a=new C(1+v,omega);C g=new C(gx,gy);C init=new C(1,0);for(int i=0;i<t;++i)init=init.mul(a);C diff=g.sub(init);C[]ans=new C[t];double abs=a.sq();double sum=0;double cur=1;for(int i=0;i<t;++i){sum+=cur;cur*=abs;}C conjA=a.conj();C zf=new C(1,0);C diffSum=diff.mul(new C(1.0/sum,0));for(int i=t-1;i>=0;--i){ans[i]=diffSum.mul(zf);zf=zf.mul(conjA);}for(int i=0;i<t;++i)out.println(ans[i].x+" "+ans[i].y);}public static void main(String[] args) {MyScanner sc = new MyScanner();out = new PrintWriter(new BufferedOutputStream(System.out));int n=sc.nextInt();for(int i=0;i<n;++i){int t=sc.nextInt();double p=sc.nextDouble();double omega=sc.nextDouble();double v=sc.nextDouble();double gx=sc.nextDouble();double gy=sc.nextDouble();solve(t,p,omega,v,gx,gy);}out.close();}// http://codeforces.com/blog/entry/7018//-----------PrintWriter for faster output---------------------------------public static PrintWriter out;//-----------MyScanner class for faster input----------public static class MyScanner {BufferedReader br;StringTokenizer st;public MyScanner() {br = new BufferedReader(new InputStreamReader(System.in));}String next() {while (st == null || !st.hasMoreElements()) {try {st = new StringTokenizer(br.readLine());} catch (IOException e) {e.printStackTrace();}}return st.nextToken();}int nextInt() {return Integer.parseInt(next());}long nextLong() {return Long.parseLong(next());}double nextDouble() {return Double.parseDouble(next());}String nextLine(){String str = "";try {str = br.readLine();} catch (IOException e) {e.printStackTrace();}return str;}}}