显示代码纯文本
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const double esp=1e-7;
int F,M,N;
int f[10011],m[10010];
bool ch[10010]={0};
class miku
{
public:
double F,M;
int pos;
}P[10010];
bool cmp(miku a,miku b)
{
return a.F/a.M>b.F/b.M;
}
void read()
{
scanf("%lf%lf%d",&P[0].F,&P[0].M,&N);
for(int i=1;i<=N;i++)
{
scanf("%lf%lf",&P[i].F,&P[i].M);
P[i].pos=i;
}
sort(P+1,P+1+N,cmp);
}
void work()
{
//for(int i=1;i<=N;i++)
// cout<<P[i].pos<<" "<<P[i].F<<" "<<P[i].M<<endl;
for(int i=1;i<=N;i++)
{
if((P[0].F+P[i].F)/(P[0].M+P[i].M)>P[0].F/P[0].M)
{
P[0].F+=P[i].F;
P[0].M+=P[i].M;
ch[P[i].pos]=1;
}
}
bool flag=0;
for(int i=1;i<=N;i++)
{
if(ch[i]==1)
{
flag=1;
printf("%d\n",i);
}
}
if(flag==0)printf("NONE\n");
}
int main()
{
freopen("sboost.in","r",stdin);
freopen("sboost.out","w",stdout);
read();
work();
return 0;
}