ZOJ Problem Set - 1242

本文介绍了一种利用碳-14衰变原理进行考古定年的算法实现。通过测量样本中残留的放射性碳-14数量,结合其衰变速率与生物体中原始比例的关系,该算法能估算出样本的大致年代。适用于1克碳样本内每小时405次衰变对应约5730年的场景。
Carbon Dating

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Until the second half of the 20th century, determining the actual age of an archaeological find had been more or less a matter of educated guessing. Comparing finds to previous, already dated, ones and evaluation of the surroundings of a find were the best available techniques.

But nowadays, there is a much more reliable method: carbon dating. Carbon dating works as follows: Naturally occurring carbon is a mixture of stable isotope (mostly 12C) and the unstable, radioactive, isotope 14C. The ratio between the two is almost constant in living organisms: 14C slowly decays, but at the same time, the radiation of the sum produces the same amount in the upper atmosphere, which is taken in by the organisms.

But when, for example, a tree is felled and made to wood, it does not receive any new 14C, and the amount present in the wood becomes less and less due to radioactive decay. In this problem, you are to write a program that uses information about the amount of remaining 14C to determine the approximate age of sample. The following facts must be used:

The amount of 14C present in a sample halves every 5730 years (this is called the half-life of 14C).

The rate of decay (measured in decays per hour per gram of carbon) is proportional to the amount of 14C left in the sample.

In living organisms (age zero), there are 810 decays per hour per gram of carbon.

So, for example, if we measure in a sample of one gram of carbon 405 decays per hour, we know that it is approximately 5730 years old.

Input

The input contains the measurements taken of several samples we want to date. Every line contains two positive integers, w and d. w is the amount of carbon in the sample, measured in grams, and d is the number of decays measured over one hour.

The input is terminated by a test case starting with w = d = 0.


Output

For each sample description in the input, first output the numnber of the sample, as shown in the sample output.Then print the approximate age in the format

The approximate age is x years.

If the age is less than 10,000 years, x should be rounded to the colsest multiple of 100 years (rounding up in case of a tie). If the age is more than 10,000 years, round it to the closest multiple of 1000 years (again rounding up in case of a tie).

Print a blank line after each sample.


Sample Input

1 405
5 175
0 0


Sample Output

Sample #1
The approximate age is 5700 years.

Sample #2
The approximate age is 26000 years.


解题报告:

题目主要意思就是根据C14计算文物年龄,根据公式即可r=ln(810/v) / ln2 衰变的次数r,速率v=d/w

还有要注意的就是输出了。


#include<iostream>
#include<cmath>
#include<cstdio> 
using namespace std;
int main()
{
	double d,w,r,Y;
	int num=0;
	while(cin>>w>>d)
	{
		if(w==0&&d==0)
		    break;
		num++;
		r=log((810.0*w/d))/log(2);   //r=ln(810/v) / ln2 衰变的次数 v=d/w   
		Y=5730*r;
		if(Y<=10000)    //小于10000年的,输出100的倍数 列如5730输出5700; 
        { 
            Y/=100; 
            Y+=0.5; 
            Y=(int)Y; 
            Y*=100; 
        } 
        else if(Y>10000)  //大于10000年的,输出1000的倍数 
        { 
            Y/=1000; 
            Y+=0.5; 
            Y=(int)Y; 
            Y*=1000; 
        }    
        cout<<"Sample #"<<num<<endl; 
        cout<<"The approximate age is "<<(int)Y<<" years."<<endl; 
        cout<<endl;
    }
    return 0;
}



基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究(Matlab代码实现)内容概要:本文围绕“基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究”,介绍了利用Matlab代码实现配电网可靠性的仿真分析方法。重点采用序贯蒙特卡洛模拟法对配电网进行长时间段的状态抽样与统计,通过模拟系统元件的故障与修复过程,评估配电网的关键可靠性指标,如系统停电频率、停电持续时间、负荷点可靠性等。该方法能够有效处理复杂网络结构与设备时序特性,提升评估精度,适用于含分布式电源、电动汽车等新型负荷接入的现代配电网。文中提供了完整的Matlab实现代码与案例分析,便于复现和扩展应用。; 适合人群:具备电力系统基础知识和Matlab编程能力的高校研究生、科研人员及电力行业技术人员,尤其适合从事配电网规划、运行与可靠性分析相关工作的人员; 使用场景及目标:①掌握序贯蒙特卡洛模拟法在电力系统可靠性评估中的基本原理与实现流程;②学习如何通过Matlab构建配电网仿真模型并进行状态转移模拟;③应用于含新能源接入的复杂配电网可靠性定量评估与优化设计; 阅读建议:建议结合文中提供的Matlab代码逐段调试运行,理解状态抽样、故障判断、修复逻辑及指标统计的具体实现方式,同时可扩展至不同网络结构或加入更多不确定性因素进行深化研究。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值