https://ac.nowcoder.com/acm/contest/23479/H
题面因为紫先做出选择并且希望离小红尽可能近那么紫只有在正方体的正中心才能达到期望最近,而小红后手选择,并且想尽可能远离紫,那么小红一定是选择8个顶点之一,因为其他的都比这个近,所以我们就能得到这个正方体的边长= 2 × x ( 3 ) \frac{2\times x}{\sqrt(3)} ( 3)2×x,则我们要求的正方体体积就为: 8 × x 3 3 × ( 3 ) \frac{8\times x^3}{3\times \sqrt(3)} 3×( 3)8×x3
代码#include
using namespace std;
//----------------自定义部分----------------
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
#define INF 0x3f3f3f3f
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
ll ksm(ll a,ll b) {
ll ans = 1;
for(;b;b>>=1LL) {
if(b & 1) ans = ans * a % mod;
a = a * a % mod;
}
return ans;
}
ll lowbit(ll x){return -x & x;}
const int N = 2e6+10;
//----------------自定义部分----------------
int n,m,q,a[N];
double x;
int main()
{
scanf("%lf",&x);
x *= 2.0;
x = x * x * x;
printf("%.5lf\n",x /(3.0 * sqrt(3)));
return 0;
}