結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
tubo28
|
| 提出日時 | 2016-12-08 02:29:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,574 ms / 4,500 ms |
| コード長 | 3,126 bytes |
| コンパイル時間 | 744 ms |
| コンパイル使用メモリ | 77,844 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 06:51:52 |
| 合計ジャッジ時間 | 10,627 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cassert>
#include <ctime>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include <cmath>
#define dump(x) std::cerr << __LINE__ << ":\t" #x " = " << x << std::endl
using namespace std;
//#define mygc(c) (c)=getchar_unlocked()
//#define mypc(c) putchar_unlocked(c)
#define mygc(c) (c)=getchar();
#define mypc(c) putchar(c)
#define ll long long
#define ull unsigned ll
void reader(int *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); }
void reader(ll *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); }
void reader(double *x) { scanf("%lf", x); }
int reader(char c[]) { int i, s = 0; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c[s++] = i; for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c[s++] = i; }c[s] = '\0'; return s; }
template <class T, class S> void reader(T *x, S *y) { reader(x); reader(y); }
template <class T, class S, class U> void reader(T *x, S *y, U *z) { reader(x); reader(y); reader(z); }
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w) { reader(x); reader(y); reader(z); reader(w); }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(ll x, char c) { int s = 0, m = 0; char f[20]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(double x, char c) { printf("%.10f", x); mypc(c); }
void writer(const char c[]) { int i; for (i = 0; c[i] != '\0'; i++)mypc(c[i]); }
void writer(const char x[], char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }
double mypow(double x, int y) {
double res = 1;
for (int i = 0; i < y; i++) {
res *= x;
}
return res;
}
double f(int a, int b, double n) {
return mypow(n, a) * mypow(log(n), b);
}
double solve(double a, double b, double t) {
if (b == 0) {
return pow(t, 1.0 / a);
} else if (a == 0) {
return exp(pow(t, 1.0 / b));
} else {
double lo = 1.0, hi = 6.0;
for (int i = 0; i < 64; ++i) {
double mid = (lo + hi) / 2;
if (f(a, b, mid) > t) {
hi = mid;
} else {
lo = mid;
}
}
return lo;
}
}
int main() {
int m;
cin >> m;
for (int i = 0; i < m; i++) {
int a, b;
double t;
reader(&a, &b, &t);
writerLn(solve(a, b, t));
// printf("%.10f\n", solve(a, b, t));
}
}
tubo28