#include <iostream.h>
#include <string.h>
char team[16][16],c[12];
int i,j,k,l,h,h1;
double p[16][16],p1[16][2];
main()
{
for(i=0;i<16;i++)
cin>>team;
for(i=0;i<16;i++)
for(j=0;j<16;j++)
cin>>p[j];
for(i=0;i<16;i++)
{p1[0]=0;p1[1]=p[i+1-2*(i%2)];}
k=4;
while(k!=32){
for(i=0;i<(16/k);i++)
for(l=i*k;l<k/2+i*k;l++)
for(j=0;j<k/2;j++)
{p1[l][0]=p1[l][0]+p1[l][1]*p[l][k/2+i*k+j]*p1[k/2+i*k+j][1]/10000;}
for(i=0;i<(16/k);i++)
for(l=i*k+k/2;l<k+i*k;l++)
for(j=0;j<k/2;j++)
{p1[l][0]=p1[l][0]+p1[l][1]*p[l][i*k+j]*p1[i*k+j][1]/10000;}
for(i=0;i<16;i++)
{p1[1]=p1[0];p1[0]=0;}
k*=2;
}
for(i=0;i<15;i++)
{h=(int) (p1[1]*1000);if(h%10>4) {h+=10;h/=10;h1=h%100;h=h/100;} else {h/=10;h1=h%100;h=h/100; }
k=strlen(team);
cout<<team[i];
k=10-k;
for(j=0;j<k;j++) cout<<' ';
cout<<"p="<<h<<'.'<<h1<<'%'<<'\n';}
h=(int) (p1[i][1]*1000);if(h%10>4) {h+=10;h/=10;h1=h%100;h=h/100;} else {h/=10;h1=h%100;h=h/100; }
k=strlen(team[i]);
cout<<team[i];
k=11-k;
for(j=0;j<k;j++) cout<<' ';
cout<<"p="<<h<<'.'<<h1<<'%';
return 0;
}
542 - France '98
Moderator: Board moderators
-
- Experienced poster
- Posts: 154
- Joined: Sat Apr 17, 2004 9:34 am
- Location: EEE, BUET
-
- New poster
- Posts: 1
- Joined: Wed Nov 25, 2009 5:29 pm
Re: 542 plz check why is WA
hi everybody
i have some problems in solving this problem so anyone can please describe me how to solve it i would be grateful
thanks in advance
i have some problems in solving this problem so anyone can please describe me how to solve it i would be grateful
thanks in advance