結果
問題 | No.456 Millions of Submits! |
ユーザー |
|
提出日時 | 2016-12-07 23:55:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
OLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,991 bytes |
コンパイル時間 | 1,541 ms |
コンパイル使用メモリ | 168,112 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 04:27:31 |
合計ジャッジ時間 | 7,403 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 OLE * 1 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))#define rep(i,j) FOR(i,0,j)#define each(x,y) for(auto &(x):(y))#define mp make_pair#define mt make_tuple#define all(x) (x).begin(),(x).end()#define debug(x) cout<<#x<<": "<<(x)<<endl#define smax(x,y) (x)=max((x),(y))#define smin(x,y) (x)=min((x),(y))#define MEM(x,y) memset((x),(y),sizeof (x))#define sz(x) (int)(x).size()typedef long long ll;typedef pair<int, int> pii;typedef vector<int> vi;typedef vector<ll> vll;/**b = 0のときn^a = ta!=0なのでよりn = t^(1/a)(a,b) = (0,1)log(n) = t >= 1.0n > elog(n) = log(e^t)n = e^t(a,b) = (0, b) (b!=0)x = e^t^(1/b)(a,b)=(1,1)x = t/W(t)(a,b)=(2,1)x = sqrt(2t/W(2t))(a,b)=(1,2)x = e^(2W(sqrt(t)/2))(a,b)=(2,2)x = e^(W(sqrt(T))a!=0 b!=0e^(b/a*W(a/b * t^(1/b))**/double lambertWFunction(double z) {double w = 5;for(int i = 0; i < 15; ++i) {double ew = exp(w);double den = ew + w*ew;if(den < 1e-13)break;double x = (w*ew - z) / (ew + w*ew);w = w - x;}return w;}double lambertWFunction2(double z) {double w = 5;for(int i = 0; i < 12; ++i) {double ew = exp(w);double x = (w*ew - z) / (ew*(w + 1) - (w + 2)*(w*ew - z) / (2 * w + 2));w = w - x;}return w;}int main(){ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;while(n--) {int a, b;double t;cin >> a >> b >> t;double ans = 0;if(a == 0) {// e^t^(1/b)double p = pow(t, 1.0 / b);ans = exp(p);} else if(b == 0) {// n = t^(1/a)ans = pow(t, 1.0 / a);} else {// e^(b/a*W(a/b * t^(1/b))double w = lambertWFunction2((double)a / b*pow(t, 1.0 / b));ans = exp((double)b / a*w);}cout << setprecision(20) << ans << endl;}}