1 在 <math.h>中
向上取整ceil();向下取整floor()
2
#include <iostream>
#include <stdio.h>
#include <math.h>
#define M_PI 3.14159265358979323846
using namespace std;
int main()
{
//freopen("out.txt","w",stdout);
int kase;
scanf("%d",&kase);
double x,y;
int temp_id=1;
int res=0;
double area=50;
double area_new=0;
while(kase--){
scanf("%lf%lf",&x,&y);
area_new=(double) M_PI*(x*x+y*y)/2.0;
//res=area_new/50;
//printf("Property %d: This property will begin eroding in year %d.\n",temp_id++,res+1);
cout<<ceil(area_new/50)<<endl;
cout<<floor(area_new/50)<<endl;
res=ceil(area_new/50);
printf("Property %d: This property will begin eroding in year %d.\n",temp_id++,res);
}
cout<<"END OF OUTPUT."<<endl;
}