zp1242.cpp
来自「浙江大学acm在线判题器代码集。 本人在浙大acm判题器上的所有代码(心血) 」· C++ 代码 · 共 34 行
CPP
34 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
#include <stdio.h>
#include <math.h>
int main(int argc, char* argv[])
{
int w,d,x,cs=0;
while (scanf("%d%d",&w,&d) && w && d)
{
x=57.3*log(1.0*d/w/810)/log(1.0/2)+0.5;
printf("Sample #%d\n",++cs);
if (x==0)
printf("The approximate age is 0 years.\n\n");
else
if (x<100)
printf("The approximate age is %d00 years.\n\n",x);
else
{
x+=5;
x/=10;
printf("The approximate age is %d000 years.\n\n",x);
}
}
return 0;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?