求加高精【悬馆】
查看原帖
求加高精【悬馆】
1647905
speedtelly楼主2025/2/6 21:47
#include<bits/stdc++.h>
using namespace std;
long long n,res,sum=1;
struct s{
    int l,f;
}a[1234];
bool cmp(s v,s b){
    return v.l*v.f<b.l*b.f;
}
int main(){
    cin>>n;
    int goul,gour;
    cin>>goul>>gour;
    for(int i=1;i<=n;i++)cin>>a[i].l>>a[i].f;
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++){
        sum=goul;
        for(int j=1;j<i;j++)sum*=a[j].l;
        res=max(res,sum/a[i].f);
    }
    cout<<res;
    return 0;
}
2025/2/6 21:47
加载中...