結果
問題 | No.456 Millions of Submits! |
ユーザー | yosupot |
提出日時 | 2016-12-08 10:50:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1,672 ms / 4,500 ms |
コード長 | 1,223 bytes |
コンパイル時間 | 600 ms |
コンパイル使用メモリ | 95,280 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-05 13:10:05 |
合計ジャッジ時間 | 5,302 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 4 ms
4,376 KB |
testcase_08 | AC | 3 ms
4,380 KB |
testcase_09 | AC | 19 ms
4,376 KB |
testcase_10 | AC | 19 ms
4,376 KB |
testcase_11 | AC | 170 ms
4,380 KB |
testcase_12 | AC | 1,672 ms
4,376 KB |
ソースコード
#include <iostream> #include <iomanip> #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <algorithm> #include <numeric> #include <random> #include <vector> #include <array> #include <bitset> #include <queue> #include <set> #include <unordered_set> #include <map> #include <unordered_map> using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); } int bsr(int x) { return 31 - __builtin_clz(x); } const double E = exp(double(1)); double calc(int a, int b, double t) { if (a == 0) { return pow(E, pow(t, 1.0/b)); } if (b == 0) { return pow(t, 1.0/a); } double x = 2; while (true) { double lx = log(x); double u = pow(x, a-1) * pow(lx, b-1); double y = u * x * lx - t; double dx = u * (a * lx + b); double diffx = y/dx; x -= diffx; // newton method if (abs(diffx) < 1e-10) break; } return x; } int main() { int m; scanf("%d", &m); for (int i = 0; i < m; i++) { int a, b; double t; scanf("%d %d %lf", &a, &b, &t); printf("%.12lf\n", calc(a, b, t)); } return 0; }