用mod啊,从最大的范围开始,逐渐变小
int x=29700;
int flag1=x mod 1000;
x=x-1000*flag1;
int flag2=x mod 500;
…………
不知道你30%是如何确定的!