| ||||||||||
| 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>
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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator