标签:for c++ amp return print string oo include
#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,布布扣,bubuko.com
HNU 12845 Ballot Analyzing Device
标签:for c++ amp return print string oo include
原文地址:http://blog.csdn.net/nenuxlp/article/details/38259527