Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
坑爹的题目(跟编程无关,像小学奥数题)#include <stdio.h> #include <math.h> double Pi=acos(-1.0); double m,n,t,c,r; int main() { int ncase; double area[5]; scanf("%d",&ncase); for(int ii=0;ii<ncase;ii++) { scanf("%lf%lf%lf%lf",&m,&n,&t,&c); r=c/2.0; area[4]=Pi*r*r*(m-1)*(n-1); area[3]=(1-Pi/4)*r*r*4*(m-1)*(n-1); area[2]=c*((t-c)*n+c)*(m-1)+c*((t-c)*m+c)*(n-1); area[1]=m*n*t*t-area[4]-area[3]-area[2]; printf("Case %d:\n",ii+1); for(int i=1;i<=4;i++) { if(i==1) printf("Probability of covering %d tile = %.4f%%\n",i,100*area[i]/(m*n*t*t)); else printf("Probability of covering %d tiles = %.4f%%\n",i,100*area[i]/(m*n*t*t)); } printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator