【April Fools Day Contest 2014E】【简单计算几何】Dome 四棱锥内切圆半径为r

E. Dome
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
【April Fools Day Contest 2014E】【简单计算几何】Dome 四棱锥内切圆半径为r_第1张图片
Input

The input contains a single floating-point number x with exactly 6 decimal places (0 < x < 5).

Output

Output two integers separated by a single space. Each integer should be between 1 and 10, inclusive. If several solutions exist, output any of them. Solution will exist for all tests.

Examples
input
1.200000
output
3 2
input
2.572479
output
10 3
input
4.024922
output
9 9
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b>a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b<a)a = b; }
const int N = 0, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
const double eps = 1e-6;
int n, m;
double ans;
void solve()
{
	for (int a = 1; a <= 10; ++a)
	{
		for (int h = 1; h <= 10; ++h)
		{
			double area = (a / 2.0*h);
			double bot = sqrt(a*a / 4.0 + h*h);
			double tmp = area / bot;
			if (fabs(tmp - ans) < eps)
			{
				printf("%d %d\n", a, h);
				return;
			}
		}
	}
}
int main()
{
	while (~scanf("%lf", &ans))
	{
		solve();
	}
	return 0;
}
/*
【题意】
什么样的四棱锥的内切球的半径可以为ans呢?
我们暴力一下就好啦


*/



你可能感兴趣的:(codeforces,计算几何,题库-CF)