您的位置:首页 > 其它

PKU 1005

2013-12-17 14:10 155 查看
比较简单吧,其实算是数学问题了

// 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=0;
cin>>n;
int year=0;
int i=0;
int *res =new int
;
while (i<n)
{
float a=0,b=0;
cin>>a>>b;
double square=pi*(a*a+b*b)/2;
double dt=square/50;
year=dt;
if(square>year*50)  //不加也可以AC
res[i]=year+1;
else
res[i]=year;
i++;
}
for (int j=0;j<n;j++)
{
printf("Property %d: This property will begin eroding in year %d.\n",j+1,res[j]);
}
printf("END OF OUTPUT.");//忘记加这个结果WA半天,也怪自己
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: