WA #8,72pts求条
查看原帖
WA #8,72pts求条
1207677
MassPoint楼主2024/12/9 21:25

rt.

代码:

#include<bits/stdc++.h>
using namespace std;
struct pty{
	char ch;
	double po;
}a[10001];
bool cmp(pty a,pty b){	return a.po>b.po;}
int t[201];
int n,m;    
int l;
int main(){
    scanf("%d%d",&n,&m);  
    for(int i=1;i<=m;i++){
        char ch;
        double x;
        cin>>ch>>x;
        if(x*20<n)	continue;
        for(int j=1;j<=14;j++)
            a[++l]=(pty){ch,x/j};       
    }
    sort(a+1,a+1+l,cmp);
    for(int i=1;i<=14;i++)	t[a[i].ch-'A']++;
    for(int i=0;i<26;i++)
        if(t[i]!=0) printf("%c %d\n",char(i+'A'),t[i]);
    return 0;
} 
2024/12/9 21:25
加载中...