結果
| 問題 | No.456 Millions of Submits! |
| コンテスト | |
| ユーザー |
yosupot
|
| 提出日時 | 2016-12-08 10:45:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
OLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| 記録 | |
| コンパイル時間 | 817 ms |
| コンパイル使用メモリ | 95,988 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 08:39:04 |
| 合計ジャッジ時間 | 5,642 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 OLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:47:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%d", &m);
| ~~~~~^~~~~~~~~~
main.cpp:50:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
50 | scanf("%d %d %lf", &a, &b, &t);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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;
for (int j = 0; j < 20; j++) {
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);
x -= y/dx; // newton
}
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("%.20lf\n", calc(a, b, t));
}
return 0;
}
yosupot