PKU 1005

时间:2024-03-23 16:36:32

比较简单吧,其实算是数学问题了

// 1005.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include "stdio.h"
#include "iostream"
using namespace std;
#define pi 3.1415926
int main(int argc, char* argv[])
{
int n=;
cin>>n;
int year=;
int i=;
int *res =new int[n];
while (i<n)
{
float a=,b=;
cin>>a>>b;
double square=pi*(a*a+b*b)/;
double dt=square/;
year=dt;
if(square>year*) //不加也可以AC
res[i]=year+;
else
res[i]=year;
i++;
}
for (int j=;j<n;j++)
{
printf("Property %d: This property will begin eroding in year %d.\n",j+,res[j]);
}
printf("END OF OUTPUT.");//忘记加这个结果WA半天,也怪自己
return ;
}