HDU 5476 Explore Track of Point
2015-10-09 11:31
375 查看
2015 ACM/ICPC Asia Regional Shanghai Online
老师推出的公式,现在还没看懂
#include <stdio.h>
#include <string.h>
#include <math.h>
const double pi = acos(-1.0);
double a, b, h, A, res;
double x1, x2, x3, y, y2, y3;
int main()
{
int t, k;
scanf("%d", &t);
k = 1;
while(t--)
{
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y, &x2, &y2, &x3, &y3);
a = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
b = sqrt((x1-x2)*(x1-x2) + (y-y2)*(y-y2));
h = sqrt(b*b-(a/2)*(a/2));
A = asin(a/(2*b));
res = h + b * a / (2 * h) * (pi - 2 * A);
printf("Case #%d: %.4lf\n",k++, res);
}
return 0;
}
老师推出的公式,现在还没看懂
#include <stdio.h>
#include <string.h>
#include <math.h>
const double pi = acos(-1.0);
double a, b, h, A, res;
double x1, x2, x3, y, y2, y3;
int main()
{
int t, k;
scanf("%d", &t);
k = 1;
while(t--)
{
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y, &x2, &y2, &x3, &y3);
a = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
b = sqrt((x1-x2)*(x1-x2) + (y-y2)*(y-y2));
h = sqrt(b*b-(a/2)*(a/2));
A = asin(a/(2*b));
res = h + b * a / (2 * h) * (pi - 2 * A);
printf("Case #%d: %.4lf\n",k++, res);
}
return 0;
}
相关文章推荐
- HDU 1568
- HDU1290
- HDU1568(Fobonacci公式)
- HDU ACM Step 2.2.2 Joseph(约瑟夫环问题)
- HDU 1405
- HDU 1297
- hdu 1205
- hdu 2087
- hdu 1016
- HDU 4898 The Revenge of the Princess’ Knight ( 2014 Multi-University Training Contest 4 )
- HDU 5240 Exam (好水的题)
- HDU5237 Base64 大模拟
- HDU 1000
- HDU 1001
- hdu-5385
- hdu-5405
- hdu-5490
- HDU 1622 Trees On The Level
- HDU 1063 Exponentiation
- Hdu5033