QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#35325#968. Extreme WealthFroggyguaWA 2ms5732kbC++17937b2022-06-15 09:17:022022-06-15 09:17:03

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-15 09:17:03]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5732kb
  • [2022-06-15 09:17:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 2020
typedef long long ll;
const long double PI=acosl(-1.0L);
ll n,m;
long double dp[N][N];
long double Get(ll n){
	if(!n)return 0;
	return n*logl(n)-n+0.5*logl(2*n*PI);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.setf(ios::fixed);
	cout.precision(10);
	cin>>n>>m;
	if(n<=1000&&m<=1000){
		for(int i=0;i<=n;++i){
			for(int j=0;j<=m;++j){
				if(!i){
					dp[i][j]=powl(2.0L,j);
				}
				else if(!j){
					dp[i][j]=powl(2.0L,i);
				}
				else{
					long double X=dp[i-1][j],Y=dp[i][j-1];
					dp[i][j]=2.0*X*Y/(X+Y);
				}
			}
		}
		if(dp[n][m]>1e9){
			cout<<"Extreme Wealth\n";
			return 0;
		}
		cout<<dp[n][m]<<'\n';
		return 0;
	}
	long double X=logl(2.0L)*(n+m);
	long double Y=Get(n+m)-Get(n)-Get(m);
	if(X-Y>30||exp(X-Y)>1e9){
		cout<<"Extreme Wealth\n";
		return 0;
	}
	cout<<exp(X-Y)<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3756kb

input:

3 2

output:

3.2000000000

result:

ok OK 3.20000000, real ans = 3.20000000, error = 0.00000000

Test #2:

score: 0
Accepted
time: 2ms
memory: 3832kb

input:

0 29

output:

536870912.0000000000

result:

ok OK 536870912.00000000, real ans = 536870912.00000000, error = 0.00000000

Test #3:

score: 0
Accepted
time: 0ms
memory: 5732kb

input:

30 0

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1073741824.00000000

Test #4:

score: 0
Accepted
time: 2ms
memory: 4012kb

input:

37 73

output:

5028.4888595832

result:

ok OK 5028.48885958, real ans = 5028.48885958, error = 0.00000000

Test #5:

score: 0
Accepted
time: 2ms
memory: 3672kb

input:

10000000000 10000000000

output:

177245.3840765427

result:

ok OK 177245.38407654, real ans = 177245.38509055, error = 0.00000001

Test #6:

score: 0
Accepted
time: 2ms
memory: 3880kb

input:

10000000000 9999412550

output:

989753698.2832225020

result:

ok OK 989753698.28322256, real ans = 989753719.13242424, error = 0.00000002

Test #7:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

10000000000 9999412400

output:

994124831.0786639510

result:

ok OK 994124831.07866395, real ans = 994124819.34340525, error = 0.00000001

Test #8:

score: 0
Accepted
time: 2ms
memory: 3792kb

input:

10000000000 9999412200

output:

999984760.8850831428

result:

ok OK 999984760.88508320, real ans = 999984746.74201429, error = 0.00000001

Test #9:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

10000000000 9999412199

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1000014138.02130949

Test #10:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

10000000000 9999411862

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1009971237.25187039

Test #11:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

10000000000 9999411861

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1010000939.12199187

Test #12:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

1000000000 100000000

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 2000288524.07298231

Test #13:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

999900000 999999999

output:

682861.8596921154

result:

ok OK 682861.85969212, real ans = 682861.86152047, error = 0.00000000

Test #14:

score: -100
Wrong Answer
time: 2ms
memory: 3748kb

input:

100000 100500

output:

1046.8229022491

result:

wrong answer WA 1046.82290225, real ans = 1046.82420753, error = 0.00000125