結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-08 00:26:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3,405 ms / 4,500 ms |
| コード長 | 918 bytes |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 33,152 KB |
| 実行使用メモリ | 96,808 KB |
| 最終ジャッジ日時 | 2024-06-23 04:47:24 |
| 合計ジャッジ時間 | 11,968 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:38:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
38 | scanf("%d", &m);
| ~~~~~^~~~~~~~~~
main.cpp:49:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
49 | scanf("%d%d%lf", &a, &b, &t);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cmath>
#include <cstdio>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
const int N = 11;
const int W = 100001;
double memo[N][N][W];
double solve(int a, int b, double t) {
int idx = floor(t * 10000 + 0.5);
if (memo[a][b][idx] >= 0) {
return memo[a][b][idx];
}
double &ret = memo[a][b][idx];
if (b == 0) {
return pow(t, 1.0 / a);
}
if (a == 0) {
return exp(pow(t, 1.0 / b));
}
double lo = 1.0, hi = 10;
REP(loop_cnt, 0, 36) {
double mid = (lo + hi) / 2;
if (pow(mid, a) * pow(log(mid), b) <= t) {
lo = mid;
} else {
hi = mid;
}
}
return ret=lo;
}
int main(void){
int m;
scanf("%d", &m);
REP(i, 0, N) {
REP(j, 0, N) {
REP(k, 0, W) {
memo[i][j][k] = -1;
}
}
}
REP(i, 0, m) {
int a, b;
double t;
scanf("%d%d%lf", &a, &b, &t);
printf("%.15f\n", solve(a, b, t));
}
}