📄 3045833_ce.c
字号:
#include <stdio.h>
#include <math.h>
double pi = 4.0*atan(1);
int main()
{
int cas, i;
double m, n, t, c;
double p1, p2, p3, p4, s;
scanf("%d",&cas);
for(i = 1; i <= cas; i++)
{
scanf("%lf%lf%lf%lf",&n,&m,&t,&c);
s = n*m*t*t;
printf("Case %d:\n",i);
p1 = (t-c)*(t-c)*(n-2.0)*(m-2.0)+(t-c/2.0)*(t-c)*(n-2.0+m-2.0)*2.0+(t-c/2.0)*(t-c/2.0)*4.0;
p1 /= s;
p4 = (n-1.0)*(m-1.0)*pi*c*c/4.0;
p4 /= s;
p3 = c*c*(m-1.0)*(n-1.0)*(1.0-pi/4.0);
p3 /= s;
p2 = 1.0-p1-p3-p4;
printf("Probability of covering 1 tile = %.4lf%%\n",p1*100.0);
printf("Probability of covering 2 tiles = %.4lf%%\n",p2*100.0);
printf("Probability of covering 3 tiles = %.4lf%%\n",p3*100.0);
printf("Probability of covering 4 tiles = %.4lf%%\n",p4*100.0);
printf("\n");
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -