跳到正文

题解

题解:P12303 [ICPC 2023 WF] 未来水世界

Ollfast_e约 2 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年6月22日
篇幅
约 2 分钟
题目
P12303

版本

  1. v2当前
  2. v1

思路

将其转化成一个求平均值的问题即可,至于证明请看下文。

证明:

证明:每一方格面积相等。

不妨设行星半径为 1 ,则每块面积为:

S块=S带÷MS_块=\textstyle S_带÷M\displaystyle

以下是球带面积推导:

首先使球面参数化。

得:

x=Rsin⁡θcos⁡φ,y=Rsin⁡θsin⁡φ,z=Rcos⁡θ\textstyle x=R\sinθ\cosφ,y=R\sinθ\sinφ,z=R\cosθ

其中,θ\theta 是极角(从 zz 轴正方向测量),ϕϕ 是方位角(从 xx 轴测量)。

球面上的面积元素为:

dA=R2sin⁡θdθdφ\textstyle dA=R^2\sinθdθdφ

假设球带介于 θ1θ1 和 θ2θ2 之间,则球带表面积为:

A=∫ ⁣θ2θ=θ1∫ ⁣πφ=0R2sin⁡θdφdθ\textstyle A=\textstyle \int \frac{\mathop{}\!\mathrm{θ} 2}{θ=θ1}\textstyle \int \frac{\mathop{}\!\mathrm{π} }{φ=0}R^2\sinθ dφ dθ

对 φφ 积分,得:

A=2πR2∫ ⁣θ2θ=θ1sin⁡θdθ\textstyle A=2πR^2\textstyle \int \frac{\mathop{}\!\mathrm{θ} 2}{θ=θ1}\sinθdθ

计算,得:

∫sin⁡θdθ=−cosθ\textstyle ∫\sin\theta dθ=-cosθ

带入高 H,有:

H=R∣cos⁡1θ−cos⁡θ2∣\textstyle H=R|\cos1θ-\cosθ2|

∵θ1<θ2∴cos⁡θ1>cos⁡θ2\textstyle ∵θ1<θ2∴\cosθ1>\cosθ2

带入,得:

A=2πRh\textstyle A=2πRh

因为等高,所以每一个环面积相等,证毕。

代码

C++
#include<iostream>
using namespace std;
double n,m,c,sum=0;
int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>c;
            sum=sum+c;
        } 
    }
    printf("%.9lf",sum/n/m);
    return 0;
}

ps:管理员大大求过。

原文