标签:
C#
using System; public class Evaporator { public static int evaporator(double content, double evap_per_day, double threshold) { return (int)Math.Ceiling(Math.Log(threshold / 100.0) / Math.Log(1.0 - evap_per_day / 100.0)); } } /* 1,Math.Ceilling(向上取整) 2,Math.Log 取对数 lne=1 http://www.cnblogs.com/yuruolt/p/4561838.html(【Math类】常用函数) */ public class Evaporator { public static int evaporator(double content, double evap_per_day, double threshold) { content = 100.0; int days = 0; while (content > threshold) { content -= content * evap_per_day * .01; days += 1; } //每天都比较下总内容和每天要散发出的,需要22天才能挥发完。 return days; } }
标签:
原文地址:http://www.cnblogs.com/gobacktomars/p/4882870.html