UVa 11646 - Athletics Track

在圆中有个矩形,知道长:宽 = a : b。设一值x,这样我们可以求出圆半径R,2*R*x = sqrt(a*x*a*x +b*x*b*x),x可化简没,sin(ang1)= b / 2R,矩形对角划分的一个角,画出图来就会知道是那个角了,这个我可以求出圆弧所对应的圆心角为 ang = 2 * ang1 。所以200 = a * x + R * x *ang,可以求出x,这样长为a * x, 宽为b * x

/*************************************************************************
 > File Name: UVa11646.cpp
 > Author: AcToy
 > Mail: ycsgldy@163.com 
 > Created Time: 2013年07月19日 星期五 17时51分24秒
 ************************************************************************/

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>

using namespace std;
typedef unsigned int u32;
typedef long long i64;
typedef unsigned long long u64;
typedef vector<int> IV;
typedef vector<bool> BV;
typedef pair<int,int> II;
typedef vector<II> IIV;
#define For(t,v,c) for(t::const_iterator v=c.begin(); v!=c.end(); ++v)
const int INF = 0x7FFFFFFF;
const double eps = 1E-10;
const double PI = acos(-1);
int main() {
	int a, b, kcase = 1;;
	char c[10];
	while(scanf("%d%s%d", &a, c, &b) == 3) {
		double R = sqrt(a * a + b * b) / 2;                                                                                                                               
		double ang = 2 * asin(b / (2 * R));
		double tmp = 200 / (ang * R + a);
		printf("Case %d: %.8lf %.8lf\n", kcase++, tmp * a, tmp * b);
	}
  return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值