結果

問題 No.456 Millions of Submits!
ユーザー zimphazimpha
提出日時 2017-04-02 14:09:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 3,824 ms / 4,500 ms
コード長 2,655 bytes
コンパイル時間 2,805 ms
コンパイル使用メモリ 74,812 KB
実行使用メモリ 76,316 KB
最終ジャッジ日時 2023-08-28 09:41:08
合計ジャッジ時間 17,075 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
55,680 KB
testcase_01 AC 112 ms
55,432 KB
testcase_02 AC 111 ms
55,660 KB
testcase_03 AC 113 ms
55,712 KB
testcase_04 AC 112 ms
55,744 KB
testcase_05 AC 134 ms
55,768 KB
testcase_06 AC 135 ms
55,848 KB
testcase_07 AC 266 ms
60,504 KB
testcase_08 AC 267 ms
59,732 KB
testcase_09 AC 440 ms
65,428 KB
testcase_10 AC 432 ms
65,992 KB
testcase_11 AC 1,243 ms
75,352 KB
testcase_12 AC 3,824 ms
76,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Chiaki.Hoshinomori
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task456 solver = new Task456();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class Task456 {
        static double e = Math.exp(1);

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            double t = in.nextDouble();
            if (b == 0) {
                out.printf("%.12f\n", Math.pow(t, 1.0 / a));
                return;
            }
            if (a == 0) {
                out.printf("%.12f\n", Math.exp(Math.pow(t, 1.0 / b)));
                return;
            }
            double q = Math.pow(t, 1.0 / b) * a / b;
            double l = Math.min(e, q);
            double r = Math.max(e, q);
            for (int it = 0; it < 40; ++it) {
                double m = (l + r) / 2;
                if (m * Math.log(m) > q) {
                    r = m;
                } else {
                    l = m;
                }
            }
            out.printf("%.12f\n", Math.pow(r, 1.0 * b / a));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }
}

0