hdu 1065_ceil的使用

http://acm.hdu.edu.cn/showproblem.php?pid=1065

#include <stdio.h>
#include <math.h> 
const double PI = 3.1415926;

int main()
{
	int t;
	scanf("%d",&t);
	for(int i = 1; i <= t; i++)
	{
		double x, y;
		scanf("%lf%lf",&x,&y);
		double d = x * x + y * y ;
		double s = 0.5 * PI * d;
		int year = ceil(s / 50.0);//返回大於或者等於指定表達式的最小整數
		printf("Property %d: This property will begin eroding in year %d.\n", i, year);
		if(i == t)
			printf("END OF OUTPUT.\n");
	}
	return 0;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章