- code:
- #include <bits/stdc++.h>
- #define setIO(s) freopen(s".in","r",stdin)
- using namespace std;
- double sq(double x) { return x*x; }
- int main()
- {
- // setIO("input");
- int k,n,m,i,j;
- scanf("%d%d%d",&k,&n,&m);
- double ans=0.0;
- for(i=1;i<=n;++i)
- {
- for(j=1;j<=m;++j)
- {
- double a=(j-1)*n;
- double b=(m-j)*n;
- double c=(n-i)*m;
- double d=(i-1)*m;
- double d1=(i-1)*(j-1);
- double d2=(i-1)*(m-j);
- double d3=(n-i)*(j-1);
- double d4=(n-i)*(m-j);
- double tot1=(sq(a)+sq(b)+sq(c)+sq(d)-sq(d1)-sq(d2)-sq(d3)-sq(d4));
- double tot2=sq(n*m);
- // printf("%.2f\n",tot1/tot2);
- ans+=1.0-pow(tot1/tot2,k);
- }
- }
- printf("%.0lf\n",ans);
- return 0;
- }
来源: http://www.bubuko.com/infodetail-3274037.html