ZOJ 3919 Ellipse(数学)
2016-02-29 18:59
393 查看
题意:
给定一个标准椭圆方程,x2a2+y2b2=1(a≥b>0)
问有一个圆心在原点(0,0)的内切圆的椭圆内接平行四边形的,最大和最小面积
分析:
显然只能内接矩形,设第一象限与椭圆的交点为(x,y)
则S矩形=2x⋅2y=4xy
x2a2+y2b2=1⇒bx2+ay2=a2∗b2
由基本不等式x2+y2≥2xy得,bx2+ay2≥2abxy
即a2∗b2≥2abxy⇒4xy≤2ab
所以Smax=2ab
最小的是个正方形,我也不知道为啥,感觉是−−设第一象限与椭圆的交点为(x,y)
x2a2+x2b2=1⇒(a2+b2)x2=a2∗b2⇒x2=a2b2a2+b2
所以Smin=4x2=4a2b2a2+b2
代码:
给定一个标准椭圆方程,x2a2+y2b2=1(a≥b>0)
问有一个圆心在原点(0,0)的内切圆的椭圆内接平行四边形的,最大和最小面积
分析:
显然只能内接矩形,设第一象限与椭圆的交点为(x,y)
则S矩形=2x⋅2y=4xy
x2a2+y2b2=1⇒bx2+ay2=a2∗b2
由基本不等式x2+y2≥2xy得,bx2+ay2≥2abxy
即a2∗b2≥2abxy⇒4xy≤2ab
所以Smax=2ab
最小的是个正方形,我也不知道为啥,感觉是−−设第一象限与椭圆的交点为(x,y)
x2a2+x2b2=1⇒(a2+b2)x2=a2∗b2⇒x2=a2b2a2+b2
所以Smin=4x2=4a2b2a2+b2
代码:
// // Created by TaoSama on 2016-02-29 // Copyright (c) 2016 TaoSama. All rights reserved. // #pragma comment(linker, "/STACK:1024000000,1024000000") #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <set> #include <vector> using namespace std; #define pr(x) cout << #x << " = " << x << " " #define prln(x) cout << #x << " = " << x << endl const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; double a, b; int main() { #ifdef LOCAL freopen("C:\\Users\\TaoSama\\Desktop\\in.txt", "r", stdin); // freopen("C:\\Users\\TaoSama\\Desktop\\out.txt","w",stdout); #endif ios_base::sync_with_stdio(0); while(scanf("%lf%lf", &a, &b) == 2) { double maxs = 2 * a * b; double mins = 4 * a * a * b * b / (a * a + b * b); printf("%.12f %.12f\n", maxs, mins); } return 0; }