結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
rickytheta
|
| 提出日時 | 2016-12-07 23:06:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4,187 ms / 4,500 ms |
| コード長 | 2,959 bytes |
| コンパイル時間 | 1,259 ms |
| コンパイル使用メモリ | 157,808 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 03:31:27 |
| 合計ジャッジ時間 | 8,278 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:116:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
116 | scanf("%d",&m);
| ~~~~~^~~~~~~~~
main.cpp: In function ‘void solve()’:
main.cpp:82:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
82 | scanf("%lf%lf%lf",&a,&b,&t);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;
// double solve1(double a,double b,double t){
// if(a==0){
// // ln(x)^b = t
// t = pow(t,1.0/b);
// return exp(t);
// }else if(b==0){
// // x^a = t;
// return pow(t,1.0/a);
// }else{
// double n = 10.0;
// REP(_,70){
// double npam1 = pow(n,a-1);
// double logn = log(n);
// double lnpbm1 = pow(logn,b-1);
// double fn = npam1*n*lnpbm1*logn - t;
// double fdn = npam1*lnpbm1*(a*logn + b);
// n -= fn/fdn;
// DEBUG(fn);
// DEBUG(fdn);
// DEBUG(n);
// }
// return n;
// }
// }
// double solve2(double a,double b,double t){
// if(a==0){
// // ln(x)^b = t
// t = pow(t,1.0/b);
// return exp(t);
// }else if(b==0){
// // x^a = t;
// return pow(t,1.0/a);
// }else{
// t = log(t);
// double lo=0.0, hi=log(25252.0);
// REP(_,75){
// double mid = (lo+hi)/2.0;
// double tt = a*mid + b*log(mid);
// if(tt<t)lo = mid;
// else hi = mid;
// }
// return exp(lo);
// }
// }
inline void solve(){
double a,b,t;
scanf("%lf%lf%lf",&a,&b,&t);
if(a==0){
// ln(x)^b = t
t = pow(t,1.0/b);
printf("%.12f\n",exp(t));
}else if(b==0){
// x^a = t;
printf("%.12f\n",pow(t,1.0/a));
}else{
// t = log(t);
// double lo=0.0, hi=log(25252.0);
// REP(_,75){
// double mid = (lo+hi)/2.0;
// double tt = a*mid + b*log(mid);
// if(tt<t)lo = mid;
// else hi = mid;
// }
// printf("%.12f\n",exp(lo));
double n = 10.0;
REP(_,50){
double npam1 = pow(n,a-1);
double logn = log(n);
double lnpbm1 = pow(logn,b-1);
double fn = npam1*n*lnpbm1*logn - t;
double fdn = npam1*lnpbm1*(a*logn + b);
n -= fn/fdn;
// DEBUG(n);
}
printf("%.12f\n",n);
}
}
int main(){
int m;
scanf("%d",&m);
while(m--)solve();
// DEBUG(solve1(10.0,10.0,5.0));
// DEBUG(solve2(10.0,10.0,5.0));
// // for(double t = 0.1; t <= 10.0; t += 0.1){
// // double x = solve1(10.0,10.0,t);
// // double y = solve2(10.0,10.0,t);
// // DEBUG(abs(x-y));
// // }
return 0;
}
rickytheta