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 Icco at 2009-12-30 10:34:15 on Problem 2261
#include<stdio.h>
int main(){
	int m,t,i,j,k,pp;
	double n;
	char a[100][100];
    double b[20][20],d[20][20]; 
	for (i=1;i<=16;i++)
		scanf("%s",&a[i]);
	for (i=1;i<=16;i++)
		for (j=1;j<=16;j++)
		{scanf("%lf",&b[i][j]);b[i][j]/=100;
		d[i][j]=0;}
    for(i=1;i<=16;i++)
		d[1][i]=1;
	for (i=2;i<=5;i++)
	{
		for (j=1;j<=16;j++)
		{  
			m=1;
			for (t=2;t<=i;t++) m*=2;
		    pp=(j-1)%m;
		   
		   n=(double)(2*j-2*pp+m-1)/2;

           for (k=j-pp;k<=j-pp+m-1;k++)
			   if ((k!=j)&&((k-n)*(j-n)<0))
		         d[i][j]+=d[i-1][j]*d[i-1][k]*b[j][k];
		}

	}



		for(i = 1;i <= 16;i++)
		printf("%-10s p=%.2lf%c\n", a[i],  d[5][i]*100, '%');
	return 0;


 

}

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