542 - France '98

All about problems in Volume 5. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
User avatar
Luchi
New poster
Posts: 3
Joined: Thu Mar 24, 2005 4:33 pm

542 - France '98

Post by Luchi »

#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;
}
Mohammad Mahmudur Rahman
Experienced poster
Posts: 154
Joined: Sat Apr 17, 2004 9:34 am
Location: EEE, BUET

Post by Mohammad Mahmudur Rahman »

Your output format is wrong. As I see, your program doesn't goto next line after the last output line. Also, note that there's a space between the country name and p=y.yy .
You should never take more than you give in the circle of life.
mohamed gaber
New poster
Posts: 1
Joined: Wed Nov 25, 2009 5:29 pm

Re: 542 plz check why is WA

Post by mohamed gaber »

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
Post Reply

Return to “Volume 5 (500-599)”