比较简单吧,其实算是数学问题了
// 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[n]; 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. ",j+1,res[j]); } printf("END OF OUTPUT.");//忘记加这个结果WA半天,也怪自己 return 0; }