11348 - Exhibition

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

Moderator: Board moderators

Re: 11348 - Exhibition

Postby asd » Sun Aug 19, 2012 2:31 am

is my code is wrong?
#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
using namespace std;
int main()
{
/* freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
int test,y=1;
scanf("%d",&test);
while(test--)
{
int n;
map<int,int>stamp;
scanf("%d",&n);
vector<int>member[n];
for(int i=0;i<n;i++)
{
int m;
scanf("%d",&m);
while(m--)
{
int s,j;
scanf("%d",&s);
for( j=0;j<member[i].size();j++)
{
if(s==member[i][j])break;
}
if(j==member[i].size()){
member[i].push_back(s);stamp[s]=stamp[s]+1;}
}//printf("\n");
}
double count[n],total=0;
for(int i=0;i<n;i++)
{
count[i]==0.0;
for(int j=0;j<member[i].size();j++)
{
int s=member[i][j];
//printf (" %d ",stamp[s]);
if(stamp[s]==1)
{
total=total+1.0;
count[i]=count[i]+1.;
}
}

}
printf("Case %d: %.6lf%c",y++,(double)count[0]*100/(double)total,37);
for(int i=1;i<n;i++)
{
printf(" %.6lf%c",(double)count[i]*100/(double)total,37);
}
printf("\n");
}
return 0;
}
asd
New poster
 
Posts: 1
Joined: Sun Aug 19, 2012 2:23 am

Re: 11348 - Exhibition

Postby brianfry713 » Mon Aug 20, 2012 10:55 pm

Yes your code is wrong, it doesn't match the sample I/O.
brianfry713
Guru
 
Posts: 1765
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Previous

Return to Volume CXIII

Who is online

Users browsing this forum: No registered users and 1 guest