10个点2个WA了,不知道哪错了
(普及-)
#include<bits/stdc++.h>
using namespace std;
double x;
int n,m=0;
struct node
{
char name;
double g;
}a[11];
node b[150];
int sum[200];
bool cmp(node p,node q)
{
if(p.g>q.g)return 1;
else return 0;
}
int main()
{
cin>>x>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].name>>a[i].g;
if(a[i].g/x>=0.05)
{
for(double j=1;j<=14;j++)
{
m++;
b[m].name=a[i].name;
b[m].g=a[i].g/j;
}
}
}
sort(b+1,b+m+1,cmp);
for(int i=1;i<=14;i++)sum[b[i].name]++;
for(int i=1;i<=14;i++)
{
int maxx=0;
for(int j=0;j<=200;j++)
{
if(sum[j]>sum[maxx])maxx=j;
}
if(maxx!=0)
{
cout<<(char)maxx<<" "<<sum[maxx]<<endl;
sum[maxx]=0;
}
else break;
}
return 0;
}