結果
| 問題 | No.620 ぐるぐるぐるりん | 
| コンテスト | |
| ユーザー |  夕叢霧香(ゆうむらきりか) | 
| 提出日時 | 2017-12-20 00:25:19 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 3,023 bytes | 
| コンパイル時間 | 2,369 ms | 
| コンパイル使用メモリ | 82,616 KB | 
| 実行使用メモリ | 47,440 KB | 
| 最終ジャッジ日時 | 2024-12-16 02:37:07 | 
| 合計ジャッジ時間 | 11,095 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | AC * 2 WA * 26 | 
ソースコード
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 div(C o){
        double f1=x*o.x+y*o.y;
        double f2=x*o.y-y*o.x;
        double s=o.sq();
        return new C(f1/s,f2/s);
    }
    C sub(C o){
        return new C(x-o.x,y-o.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];
        for(int i=0;i<t;++i)ans[i]=new C(0,0);
        double abs=Math.sqrt(a.sq());
        double sum=0;
        double cur=1;
        for(int i=0;i<t;++i){
            sum+=cur;
            cur*=abs;
        }
        cur=1;
        C inva=new C(1,0).div(a);
        C zf=new C(1,0);
        for(int i=0;i<t;++i){
            double f=cur/sum;
            ans[i]=diff.mul(new C(f,0)).mul(zf);
            cur*=abs;
            zf=zf.mul(inva);
        }
        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;
        }
    }
}
            
            
            
        