QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#762422#8027. Sky Gardenyzc_yzcAC ✓0ms3908kbC++141.0kb2024-11-19 14:55:502024-11-19 14:55:50

Judging History

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

  • [2024-11-19 14:55:50]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3908kb
  • [2024-11-19 14:55:50]
  • 提交

answer

#include<bits/stdc++.h>
#define double long double
#define int long long
using namespace std;
const int maxn=1e7+5;
const int mod=998244353;
const double PI=acos(-1);
int n,m;
double f[maxn],g[maxn],pref,preg;
int qpow(int a,int b){
	int ans=1;
	while(b){
		if(b&1)(ans*=a)%=mod;
		(a*=a)%=mod;
		b>>=1;
	}
	return ans;
}
signed main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	cin>>n>>m;
	if(n==1&&m==1){
		cout<<2;
		return 0;
	}
	int tot=0;
	double lim=(double)2*m/PI;
	int o=qpow(m,mod-2);
	for(int i=1;i<=m;i++){
		int k=i;
		if((double)k*PI>2*m){
			f[1]+=2;
		}
		else g[1]+=(double)i/m;
	}
	f[1]=(2*f[1]-2)*m;g[1]=g[1]*2*m;
	pref=f[1],preg=g[1];
	for(int i=2;i<=n;i++){
		f[i]=i*f[1],g[i]=i*g[1];
		f[i]=(f[i]+(i-1)*4*m*m+(i-1)*f[1]+f[i-1]);
		g[i]=(g[i]+(g[1]*(i-1))+g[i-1]);
		pref=(pref+f[i]);
		preg=(preg+g[i]);
	}
	cout<<setprecision(10)<<(double)pref+(m!=1)*m*(n+1)*n+(double)preg*PI;
//	printf("%.10lf\n",(double)pref+m*(n+1)*n+(double)preg*PI);
//	printf("%.10lf",(double)(preg)*PI);
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3856kb

input:

1 2

output:

14.28318531

result:

ok found '14.2831853', expected '14.2831853', error '0.0000000'

Test #2:

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

input:

1 1

output:

2

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #3:

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

input:

500 1

output:

166916500

result:

ok found '166916500.0000000', expected '166916500.0000000', error '0.0000000'

Test #4:

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

input:

500 2

output:

763585309.6

result:

ok found '763585309.6000000', expected '763585309.5613225', error '0.0000000'

Test #5:

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

input:

500 499

output:

4.912527713e+13

result:

ok found '49125277130000.0000000', expected '49125277129819.2734375', error '0.0000000'

Test #6:

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

input:

500 500

output:

4.932236999e+13

result:

ok found '49322369990000.0000000', expected '49322369986259.6953125', error '0.0000000'

Test #7:

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

input:

252 139

output:

4.88838606e+11

result:

ok found '488838606000.0000000', expected '488838606007.1795654', error '0.0000000'

Test #8:

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

input:

96 359

output:

1.812771902e+11

result:

ok found '181277190200.0000000', expected '181277190205.0371094', error '0.0000000'

Test #9:

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

input:

237 487

output:

4.992630041e+12

result:

ok found '4992630041000.0000000', expected '4992630041184.1953125', error '0.0000000'

Test #10:

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

input:

81 411

output:

1.429535823e+11

result:

ok found '142953582300.0000000', expected '142953582310.2773743', error '0.0000000'

Test #11:

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

input:

221 39

output:

2.596864193e+10

result:

ok found '25968641930.0000000', expected '25968641931.5297089', error '0.0000000'

Test #12:

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

input:

270 259

output:

2.087014642e+12

result:

ok found '2087014642000.0000000', expected '2087014641700.0227051', error '0.0000000'

Test #13:

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

input:

422 387

output:

1.777019303e+13

result:

ok found '17770193030000.0000000', expected '17770193032349.6250000', error '0.0000000'

Test #14:

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

input:

63 15

output:

89852047.51

result:

ok found '89852047.5100000', expected '89852047.5085171', error '0.0000000'

Test #15:

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

input:

407 439

output:

2.05152961e+13

result:

ok found '20515296100000.0000000', expected '20515296102923.2070312', error '0.0000000'

Test #16:

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

input:

18 18

output:

3123573.696

result:

ok found '3123573.6960000', expected '3123573.6956476', error '0.0000000'

Test #17:

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

input:

171 146

output:

1.687861792e+11

result:

ok found '168786179200.0000000', expected '168786179167.0194092', error '0.0000000'

Test #18:

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

input:

311 70

output:

2.328755095e+11

result:

ok found '232875509500.0000000', expected '232875509505.2748413', error '0.0000000'

Test #19:

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

input:

155 494

output:

1.439825968e+12

result:

ok found '1439825968000.0000000', expected '1439825967582.9992676', error '0.0000000'

Test #20:

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

input:

204 418

output:

2.347066265e+12

result:

ok found '2347066265000.0000000', expected '2347066265474.4873047', error '0.0000000'

Test #21:

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

input:

344 46

output:

1.360546904e+11

result:

ok found '136054690400.0000000', expected '136054690372.2714844', error '0.0000000'

Test #22:

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

input:

188 174

output:

3.184299021e+11

result:

ok found '318429902100.0000000', expected '318429902145.0420532', error '0.0000000'

Test #23:

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

input:

137 394

output:

6.328964879e+11

result:

ok found '632896487900.0000000', expected '632896487876.0313721', error '0.0000000'

Test #24:

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

input:

481 22

output:

8.502095459e+10

result:

ok found '85020954590.0000000', expected '85020954588.2031097', error '0.0000000'

Test #25:

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

input:

30 446

output:

8705279441

result:

ok found '8705279441.0000000', expected '8705279441.3520851', error '0.0000000'

Test #26:

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

input:

204 440

output:

2.600626526e+12

result:

ok found '2600626526000.0000000', expected '2600626525627.9575195', error '0.0000000'

Test #27:

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

input:

2 3

output:

175.4159265

result:

ok found '175.4159265', expected '175.4159265', error '0.0000000'

Extra Test:

score: 0
Extra Test Passed