1242.cpp

来自「ZOJ 动态规划算法题目入门与提高 源代码」· C++ 代码 · 共 21 行

CPP
21
字号
#include<cstdio>
#include<cmath>

int main()
{
    //freopen("in.txt","r",stdin);
    int w,d;
    int line=0;
    long long int age=0;
    while(scanf("%d %d",&w,&d) && w && d)
    {
        line++;
        double temp =log2(810*w*1.0/d);
        temp *=5730;
        if(temp < 10000) age=int(temp/100+0.5)*100;
        else if( temp > 10000) age=int(temp/1000+0.5)*1000;
        //if(line>1) printf("\n"); 
        printf("Sample #%d\nThe approximate age is %lld years.\n\n",line,age);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?