Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

坑爹的题目(跟编程无关,像小学奥数题)

Posted by javvy at 2013-06-13 00:56:09 on Problem 3440
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator