結果

問題 No.456 Millions of Submits!
ユーザー 37zigen37zigen
提出日時 2016-12-08 14:58:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 973 bytes
コンパイル時間 4,215 ms
コンパイル使用メモリ 74,824 KB
実行使用メモリ 88,920 KB
最終ジャッジ日時 2023-09-05 15:25:53
合計ジャッジ時間 20,647 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
60,124 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.*;

public class Q456 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		while (m-- > 0) {
			double a = sc.nextDouble();
			double b = sc.nextDouble();
			double t = sc.nextDouble();
			double ans;
			if (a == 0) {
				t = Math.pow(t, 1 / b);
				ans =Math.exp(t);
			} else if (b == 0) {
				t = Math.pow(t, 1 / a);
				ans = t;
			} else {
				double curN = 30;
				for (int i = 0; i < 10; ++i) {
					double y = -t + pow(curN, (int) a) * pow(Math.log(curN), (int) b);
					double yDiff = a * pow(curN, (int) a - 1) * pow(Math.log(curN), (int) b)
							+ b * pow(curN, (int) a - 1) * pow(Math.log(curN), (int) b - 1);
					curN = curN - y / yDiff;
				}
				ans = curN;
			}
			System.out.printf("%.12f\n",ans);
		}
	}

	static double pow(double a, int n) {
		double ret = 1;
		for (; n > 0; n >>= 1, a *= a) {
			if (n % 2 == 1) {
				ret *= a;
			}
		}
		return ret;
	}
}
0