QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#408760#8027. Sky GardenTomato_FishAC ✓276ms3912kbC++14909b2024-05-10 23:27:472024-05-10 23:27:48

Judging History

This is the latest submission verdict.

  • [2024-05-10 23:27:48]
  • Judged
  • Verdict: AC
  • Time: 276ms
  • Memory: 3912kb
  • [2024-05-10 23:27:47]
  • Submitted

answer

#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define pi (acos(-1))

typedef long double db;
typedef long long ll;
const int mod=998244353; 
const int N=1e7+100;
const db eps=1e-12;

int mi(int x,int t){
	int d=1;
	while(t){
		if(t%2) d=(ll)d*x%mod;
		x=(ll)x*x%mod;t/=2;
	}
	return d;
}
int ni(int x) {return mi(x,mod-2);}

int f[N],fl[N],nf[N],Ni[N];

db Abs(db x){
	if(x<eps) return -x;
	return x;
}
db mymin(db x,db y) {return (x<y?x:y);}

int main()
{
	
	int n,m;
	scanf("%d%d",&n,&m);
	
	db Ans=0;m*=2;
	for(int ii=0;ii<m;ii++){
		int i=min(ii,m-ii);
		db t1=(db)2*(db)pi*(db)i/m;
		if(t1<2-eps){
			for(int j=1;j<=n;j++)
				for(int k=1;k<=n;k++)
					Ans=Ans+Abs(j-k)+mymin(j,k)*t1;
		}
		else{
			Ans=Ans+n*(n+1)*n;
		}
	}
	
	Ans=Ans*m+n*(n+1)*m*(m>2);
	Ans/=2;
	
	printf("%.12Lf\n",Ans);
	
//	dfsdkfjsdklfjklsdjf
	
	return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3860kb

input:

1 2

output:

14.283185307180

result:

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

Test #2:

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

input:

1 1

output:

2.000000000000

result:

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

Test #3:

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

input:

500 1

output:

166916500.000000000000

result:

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

Test #4:

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

input:

500 2

output:

763585309.561322442547

result:

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

Test #5:

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

input:

500 499

output:

49125277129819.332263946533

result:

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

Test #6:

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

input:

500 500

output:

49322369986260.022201538086

result:

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

Test #7:

score: 0
Accepted
time: 20ms
memory: 3796kb

input:

252 139

output:

488838606007.178826481104

result:

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

Test #8:

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

input:

96 359

output:

181277190205.037145391107

result:

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

Test #9:

score: 0
Accepted
time: 61ms
memory: 3820kb

input:

237 487

output:

4992630041184.196222782135

result:

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

Test #10:

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

input:

81 411

output:

142953582310.277371153235

result:

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

Test #11:

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

input:

221 39

output:

25968641931.529724163935

result:

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

Test #12:

score: 0
Accepted
time: 42ms
memory: 3820kb

input:

270 259

output:

2087014641700.021612286568

result:

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

Test #13:

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

input:

422 387

output:

17770193032349.630771636963

result:

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

Test #14:

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

input:

63 15

output:

89852047.508517054906

result:

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

Test #15:

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

input:

407 439

output:

20515296102923.173889160156

result:

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

Test #16:

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

input:

18 18

output:

3123573.695647555352

result:

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

Test #17:

score: 0
Accepted
time: 10ms
memory: 3852kb

input:

171 146

output:

168786179167.019472301006

result:

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

Test #18:

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

input:

311 70

output:

232875509505.274871334434

result:

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

Test #19:

score: 0
Accepted
time: 27ms
memory: 3912kb

input:

155 494

output:

1439825967582.997259020805

result:

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

Test #20:

score: 0
Accepted
time: 39ms
memory: 3820kb

input:

204 418

output:

2347066265474.490070104599

result:

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

Test #21:

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

input:

344 46

output:

136054690372.271622970700

result:

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

Test #22:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

188 174

output:

318429902145.041761606932

result:

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

Test #23:

score: 0
Accepted
time: 17ms
memory: 3820kb

input:

137 394

output:

632896487876.031693994999

result:

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

Test #24:

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

input:

481 22

output:

85020954588.203154996037

result:

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

Test #25:

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

input:

30 446

output:

8705279441.352084546350

result:

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

Test #26:

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

input:

204 440

output:

2600626525627.952620267868

result:

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

Test #27:

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

input:

2 3

output:

175.415926535898

result:

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

Extra Test:

score: 0
Extra Test Passed