weight<=0.5 Num=1
0.5<weight<=1 Num=2
1<weight<=1.5 Num=3
1.5<weight<=2 Num=4
...... ......
以此类推,需要写个算法来求Num的值
int CalcNum(weight) {
...... return num; }
int CalcNum(double weight)
{
if (weight <= 0.5) return 1;
return (int)Math.Ceiling(2 * weight);
}
非常感谢!