POJ P1005,很简单的题目,求出以给定点到原点为半径的半圆的面积,再看够几年侵蚀的(有几个50平方英里)。代码如下:
#include#define PI 3.141592int main(){ int n; float x, y, s; int i, year; scanf("%d", &n); for (i = 1; i <= n; i++){ scanf("%f%f", &x, &y); s = PI * (x*x + y*y); year = s / 100 +1; printf("Property %d: This property will begin eroding in year %d.\n", i, year); } puts("END OF OUTPUT."); system("pause");}
不多解释,只为做个记录。