結果

問題 No.471 直列回転機
ユーザー kuuso1
提出日時 2016-12-21 00:43:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 380 ms / 3,141 ms
コード長 1,664 bytes
コンパイル時間 4,179 ms
コンパイル使用メモリ 106,624 KB
実行使用メモリ 43,608 KB
平均クエリ数 19588.39
最終ジャッジ日時 2024-06-11 10:21:30
合計ジャッジ時間 16,543 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 58
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;


class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int M = ri();
		Complex[] C = new Complex[M];
		
		int[] d;
		
		for(int i=0;i<M;i++){
			d = ria();
			C[i] = new Complex(d[0],d[1]);
		}
		
		var x = new Complex(1,0);
		Console.WriteLine("? 1 0");
		Console.Out.Flush();
		d = ria();
		var alpha = new Complex(d[0],d[1]);
		
		var y = new Complex(0,1);
		Console.WriteLine("? 0 1");
		Console.Out.Flush();
		d = ria();
		var beta = new Complex(d[0],d[1]);
		
		
		var phi = (alpha - beta) / (x - y);
		var psi = alpha - phi * x;
		
		var sb = new StringBuilder();
		sb.AppendLine("!");
		for(int i=0;i<M;i++){
			var z = phi * C[i] + psi;
			int re = (int) z.Real;
			int im = (int) z.Imaginary;
			sb.AppendLine(String.Format("{0} {1}",re,im));
		}
		
		Console.Write(sb.ToString());
		Console.Out.Flush();
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0