#include<bits/stdc++.h>
using namespace std;
struct vote{
int x;
string s;
}v[20];
bool cmp(vote a,vote b)
{
return a.x>b.x;
}
int main()
{
int n,m;
string str;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
cin>>str;
v[i].s=str;
}
int sum=0,inv=0;
for(int i=1;i<=m;i++)
{
cin>>str;
int count=0;
for(int j=0;j<n;j++)
{
if(str[j]=='X')
count++;
}
if(count==1)
{
for(int j=0;j<n;j++)
{
if(str[j]=='X')
v[j+1].x++;
}
}
else
inv++;
}
sort(v+1,v+n+1,cmp);
for(int i=1;i<=n;i++)
{
cout<<v[i].s<<" ";
printf("%.2lf%%\n",v[i].x*1.0/m*100);
}
printf("Invalid %.2lf%%\n",inv*1.0/m*100);
return 0;
}
HNU 12845 Ballot Analyzing Device
最新推荐文章于 2024-11-02 19:56:01 发布