不是很懂你们经济学
边际效应递减……
即使你是抢劫犯也要学点经济学:)
好吧其实是数学归纳
所以数学好的都去帮别人分钱了?
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
const int N=1000+5;
int X[N],K[N];
struct hn{
double d;
int i;
bool operator < (const hn &rhs)const{
return d<rhs.d;
}
};
priority_queue<hn>q;
int main(){
//freopen("a.in","r",stdin);
int n,m,y;scanf("%d%d%d",&n,&m,&y);
for(int i=1;i<=n;i++)
scanf("%d",&X[i]);
int r=m;
for(int i=1;i<=n;i++){
K[i]=m/y;r-=K[i];
q.push((hn){(double)X[i]/y-(double)K[i]/m,i});
}
while(r--){
hn tmp=q.top();q.pop();
int i=tmp.i;K[i]++;
q.push((hn){(double)X[i]/y-(double)K[i]/m,i});
}
for(int i=1;i<=n;i++)
printf("%d ",K[i]);
return 0;
}