結果

問題 No.813 ユキちゃんの冒険
ユーザー 37zigen37zigen
提出日時 2018-07-04 04:41:18
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,534 bytes
コンパイル時間 3,216 ms
コンパイル使用メモリ 87,956 KB
実行使用メモリ 58,188 KB
最終ジャッジ日時 2023-08-30 13:22:43
合計ジャッジ時間 8,767 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	double Z = 376.730313461;

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double theta = sc.nextDouble();
		double phi = sc.nextDouble();
		double sigma = sc.nextDouble();
		double pR = Z * sigma * Math.cos(theta) / (2 + Z * sigma * Math.cos(theta)) * Math.sin(phi);
		double pT = 2 / (2 + Z * sigma * Math.cos(theta)) * Math.sin(phi);
		double sR = Z * sigma / (2 * Math.cos(theta) + Z * sigma) * Math.cos(phi);
		double sT = 2 * Math.cos(theta) / (2 * Math.cos(theta) + Z * sigma) * Math.cos(phi);
		pR = Math.cos(pR);
		pT = Math.cos(pT);
		sR = Math.cos(sR);
		sT = Math.cos(sT);
		double[] pRT = calcRT(pR, pT, N);
		double[] sRT = calcRT(sR, sT, N);
		double R = pRT[0] * pRT[0] + sRT[0] * sRT[0];
		double T = pRT[1] * pRT[1] + sRT[1] * sRT[1];
		double A = 1 - R - T;
		if (A > 1 || A < 0)
			throw new AssertionError();
		System.out.println(R + " " + T + " " + A);
	}

	double[] calcRT(double r, double t, int n) {
		double[] a = { r, t };
		double[] ans = { 0, 1 };
		for (; n > 0; n >>= 1, a = merge(a, a)) {
			if (n % 2 == 1) {
				ans = merge(ans, a);
			}
		}
		return ans;
	}

	double[] merge(double[] a, double[] b) {
		double[] ret = { a[0] + a[1] * a[1] * b[0] / (1 - a[0] * b[0]), a[1] * b[1] / (1 - a[0] * b[0]) };
		return ret;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0