本文主要是介绍【April Fools Day Contest 2014E】【简单计算几何】Dome 四棱锥内切圆半径为r,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
The input contains a single floating-point number x with exactly 6 decimal places (0 < x < 5).
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.
1.200000
3 2
2.572479
10 3
4.024922
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呢?
我们暴力一下就好啦*/
这篇关于【April Fools Day Contest 2014E】【简单计算几何】Dome 四棱锥内切圆半径为r的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!