QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#211678#4618. Conquest of Masters Touryiyiyi#WA 1ms3916kbC++14774b2023-10-12 20:17:442023-10-12 20:17:44

Judging History

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

  • [2023-10-12 20:17:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3916kb
  • [2023-10-12 20:17:44]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define re register
#define inf 0x3f3f3f3f
#define N 10202000
using namespace std;
const int mo=998244353;
inline int read(){
    int x=0,w=0;char ch=getchar();
    while (!isdigit(ch))w|=ch=='-',ch=getchar();
    while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
    return w?-x:x;
}
double a[10][10];
int p[20];
signed main(){
	int T=read();
	while (T--){
		int n=read();
		for (int i=1;i<=n;++i)
			for (int j=1;j<=n;++j)
				scanf("%lf",&a[i][j]);
		for (int i=1;i<=n;++i)p[i]=i;
		double ans=0;
		do{
			double x=1;
			for (int i=1;i<=n;++i)x*=a[i][p[i]];
			ans+=x;
		}while (next_permutation(p+1,p+1+n));
		for (int i=1;i<=n;++i)ans/=i;
		printf("%.10lf\n",ans);
	}
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3916kb

input:

5
8
0.55 0.48 0.54 0.61 0.79 0.69 0.07 0.40
0.54 0.92 0.60 0.64 0.97 0.94 0.13 0.46
0.31 0.99 0.73 0.24 0.19 0.11 0.08 0.47
0.23 0.10 0.61 0.22 0.08 0.14 0.56 0.88
0.84 0.02 0.20 0.64 0.26 0.66 0.07 0.23
0.36 0.42 0.26 0.53 0.58 0.60 0.07 0.35
0.65 0.94 0.62 0.57 0.21 0.00 0.40 0.50
0.81 0.45 0.16 0...

output:

0.0014118240
0.0033713657
0.0004240410
0.0033688862
0.0011884931

result:

wrong answer 1st numbers differ - expected: '0.3106371', found: '0.0014118', error = '0.3092253'