⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2507.txt

📁 北大ACM题目例程 详细的解答过程 程序实现 算法分析
💻 TXT
字号:

Memory:52K  Time:0MS
Language:G++  Result:Accepted

Source 

#include "stdio.h"
#include "math.h"

int main()
{
	double x, y, c, a, b, w, t;

	while( scanf( "%lf%lf%lf", &x, &y, &c ) == 3 )
	{
		b = x;
		if( b > y ) b = y;
		a = 0;
		
		while( b - a > 1e-7 )
		{
			w = ( a + b ) / 2;
			
			t = w / ( w / sqrt( y*y - w*w ) + w / sqrt( x*x - w*w ) );
			if( fabs( t-c ) < 1e-7 ) break;
			if( t > c ) a = w;
			else b = w;
		}

		printf( "%.3lf\n", w );
	}
 
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -