結果
問題 | No.456 Millions of Submits! |
ユーザー | zimpha |
提出日時 | 2017-04-02 14:09:40 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 3,863 ms / 4,500 ms |
コード長 | 2,655 bytes |
コンパイル時間 | 3,097 ms |
コンパイル使用メモリ | 77,624 KB |
実行使用メモリ | 64,692 KB |
最終ジャッジ日時 | 2024-06-09 05:16:36 |
合計ジャッジ時間 | 17,290 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
41,168 KB |
testcase_01 | AC | 127 ms
41,280 KB |
testcase_02 | AC | 125 ms
41,020 KB |
testcase_03 | AC | 124 ms
41,256 KB |
testcase_04 | AC | 127 ms
41,536 KB |
testcase_05 | AC | 150 ms
41,344 KB |
testcase_06 | AC | 156 ms
42,044 KB |
testcase_07 | AC | 271 ms
47,640 KB |
testcase_08 | AC | 270 ms
47,844 KB |
testcase_09 | AC | 443 ms
52,632 KB |
testcase_10 | AC | 440 ms
52,768 KB |
testcase_11 | AC | 1,272 ms
64,692 KB |
testcase_12 | AC | 3,863 ms
64,348 KB |
ソースコード
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()); } } }