//半衰期log2 ?
//代码参考网上的,用到了换底公式
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{int w, d, cout = 1;int dec = 5730, result;double temp, year;while( scanf( "%d%d", &w, &d )!= EOF && w ){temp = 810.0*w/d;year = 5730 * log(temp)/log(2);if( year < 10000 ){result = 100*(int)(year/100 + 0.5);}else{result = 1000*(int)(year/1000 + 0.5);}printf("Sample #%d\nThe approximate age is %d years.\n\n",cout++, result);}return 0;
}
详细解决方案
ZOJ 1242
热度:34 发布时间:2024-01-11 16:43:18.0
相关解决方案
- 异常#1242 - Subquery returns more than 1 row的有关问题
- 51Nod - 1242(矩阵快速幂)
- AcWing 1242. 修改数组 并查集的另类做法
- 51Nod 1242 斐波那契数列的第N项 (矩阵快速幂)
- HDU 1242 Rescue (DFS)
- 斐波那契数列的第N项 51Nod - 1242
- hdu 1242 畅通工程
- Lintcode:1242. Non-overlapping Intervals
- ZOJ 1242
- 51 nod 1242 斐波那契数列的第N项(矩阵快速幂的模板)
- OJ 1242 大一上之初出茅庐
- hdu 1242 Rescue (BFS+优先队列)