题目:
分析:算是自己想的数学推导吧!
代码:上述可以可以分析得到,乘积大的直接在前面,但是结果涉及高精度,所以没ac:
#include<bits/stdc++.h>
using namespace std;
struct node{
int x1;
int x2;
} nn[10005];
bool cmp(node n1,node n2)
{
return n1.x2*n1.x1<n2.x2*n2.x1;
}
int m;
int main()
{
cin>>m;
int a1,a2;
cin>>nn[0].x1>>nn[0].x2;
for(int i=1;i<=m;i++)
{
cin>>nn[i].x1>>nn[i].x2;
}
sort(nn+1,nn+m+1,cmp);
long long now=1;
long long maxx=1;
for(int i=1;i<=m;i++)
{
now=now*nn[i-1].x1;
maxx=max(maxx,(now)/nn[i].x2);
}
cout<<maxx;
}