标签是期望,可是没人做期望
查看原帖
标签是期望,可是没人做期望
230808
Zxsoul楼主2021/5/19 21:31

求一个期望的做法,本人的期望才 7070

#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
#define d double
using namespace std;

const int A = 1e7+10;
const int B = 1e6+10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for ( ; !isdigit(c); c = getchar()) if (c == '-') f = -1;
  for ( ; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  return x * f;
}
double ans;
double s1,s2,s3;

int main()
{
	scanf("%lf%lf%lf",&s1,&s2,&s3);
	d p1=1/s1,p2=1/s2,p3=1/s3;
	for (d i=1;i<=s1;i++)
		for (d j=1;j<=s2;j++)
			for (double k=1;k<=s3;k++)
			{
				ans+=(i+j+k);
			}
	d ans1=ans*(p1*p2*p3);
	printf("%lf",ans1);
} 
2021/5/19 21:31
加载中...