百炼OJ

题目链接:http://bailian.openjudge.cn/practice/1005/

思路

一个半圆面积每年增长50,已知一个点坐标,求第几年点在半圆内。

#include <stdio.h>
#include <math.h>

#define pai 3.1415926
int main()
{
	int n;
	double x,y;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lf %lf",&x,&y);
		double d = sqrt(x*x+y*y);
		for(int j=1;;j++)
		{
			double r = sqrt((j*100.0)/pai);
			if( r > d )
			{
				printf("Property %d: This property will begin eroding in year %d.
",i+1,j);
				break;
			}
		}
	}
	puts("END OF OUTPUT.");
	return 0;
}
原文地址:https://www.cnblogs.com/L1B0/p/10906642.html