I had submitted attached file scores1.cpp and out1.txt but it was showing
wrong answer
although I could not find difference(>10^-5) in my output file out1.txt and
Accepted file opsach.txt ....???
Somebody please help...
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-code/-/Cxic_PoyKaMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.
Case #1: 33.333332 66.666664
Case #2: 0.000000 100.000000
Case #3: 25.000000 25.000000 25.000000 25.000000
Case #4: 34.666668 26.666666 38.666668
Case #5: 14.285714 14.285714 14.285714 14.285714 14.285714 14.285714 14.285714
0.000000
Case #6: 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
10.000000 10.000000 10.000000
Case #7: 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
10.000000 10.000000 10.000000
Case #8: 1.689977 14.743589 13.344988 14.743589 13.344988 14.044289 14.510489
13.578089
Case #9: 66.666664 33.333332
Case #10: 19.047619 19.047619 19.047619 19.047619 4.761905 19.047619
Case #11: 0.000000 0.000000 19.900249 20.149626 20.149626 19.900249 0.000000
19.900249 0.000000
Case #12: 100.000000 0.000000
Case #13: 19.238094 14.793651 22.571428 14.349206 14.571428 8.126985 6.349206
Case #14: 64.220184 35.779816
Case #15: 50.000000 50.000000
Case #16: 0.000000 0.000000 28.497410 22.279793 23.316063 25.906736
Case #17: 11.111111 11.111111 11.111111 11.111111 0.000000 11.111111 11.111111
11.111111 11.111111 11.111111
Case #18: 25.438597 24.310778 24.686716 10.776942 5.889724 8.897243
Case #19: 46.153847 53.846153
Case #20: 10.884354 13.378685 9.070294 10.430839 13.832199 11.337869 11.791383
9.523809 9.750566
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n,i,j,t,m=0;
float a[100],sum,ans[100],nwa[100],jk,nw,nwsm;
cin>>t;
while(t--)
{
m++;
cin>>n;
sum=0;
for(i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
nwsm=2*sum;
nw=n;
for(i=0;i<n;i++)
{
if(a[i]>=(sum*2)/n)
{
nwsm=nwsm-a[i];
nw--;
nwa[i]=-1;
}
else
nwa[i]=a[i];
}
for(i=0;i<n;i++)
if(nwa[i]==-1)
ans[i]=0;
else
ans[i]= ((((nwsm)/nw)-nwa[i])/sum)*100;
cout.precision(5);
cout<<"Case #"<<m<<": ";
for(i=0;i<n;i++)
{
cout<<fixed<<ans[i]<<" ";
}
cout<<"\n";
}
getch();
return 0;
}
Case #1: 33.333334 66.666667
Case #2: 0.000000 100.000000
Case #3: 25.000000 25.000000 25.000000 25.000000
Case #4: 34.666667 26.666667 38.666667
Case #5: 14.285715 14.285715 14.285715 14.285715 14.285715 14.285715 14.285715
0.000000
Case #6: 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
10.000000 10.000000 10.000000
Case #7: 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
10.000000 10.000000 10.000000
Case #8: 1.689977 14.743590 13.344989 14.743590 13.344989 14.044289 14.510490
13.578089
Case #9: 66.666667 33.333334
Case #10: 19.047619 19.047619 19.047619 19.047619 4.761905 19.047619
Case #11: 0.000000 0.000000 19.900250 20.149627 20.149627 19.900250 0.000000
19.900250 0.000000
Case #12: 100.000000 0.000000
Case #13: 19.238096 14.793651 22.571429 14.349207 14.571429 8.126985 6.349207
Case #14: 64.220184 35.779817
Case #15: 50.000000 50.000000
Case #16: 0.000000 0.000000 28.497410 22.279793 23.316062 25.906736
Case #17: 11.111111 11.111111 11.111111 11.111111 0.000000 11.111111 11.111111
11.111111 11.111111 11.111111
Case #18: 25.438597 24.310777 24.686717 10.776943 5.889725 8.897243
Case #19: 46.153846 53.846154
Case #20: 10.884354 13.378685 9.070295 10.430840 13.832200 11.337869 11.791383
9.523810 9.750567