UVA昨天上不去,今天一大早起来还是上不去 0.0
于是去ZOJ
这题大意就是半衰期。。。
取对数用到了换底公式。。。我都忘了这玩意了T T
上代码。。。
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double w ,d,n;
int count=1;
while(cin>>w>>d,w||d)
{
d/=w;
n=5730*log(d/810)/log(0.5);
if(n<10000)
n=int (n+50)/100*100;
else
n=int (n+500)/1000*1000;
cout<<"Sample #"<<count++<<endl<<"The approximate age is "<<n<<" years."<<endl<<endl;
}
return 0;
}