# hdoj 3209 Jumping Hands

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;

const double PI = acos(-1.0);
int l1, l2, l3, m1, m2, m3;
int hh, mm, ss;
int st, ed;

struct Point {
double x, y;
};

double getdis(Point a, Point b) {
return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}

Point getpoint(int t) {
Point p, ph, pm, ps;
double w = m1 + m2 +m3;
double lh, lm, ls, ah, am, as;
lh = l1*m1/w;
lm = l2*m2/w;
ls = l3*m3/w;
ah = 2*PI*t/43200;
am = 2*PI*t/3600;
as = 2*PI*t/60;
ph.x = sin(ah)*lh;
ph.y = cos(ah)*lh;
pm.x = sin(am)*lm;
pm.y = cos(am)*lm;
ps.x = sin(as)*ls;
ps.y = cos(as)*ls;
p.x = ph.x + pm.x + ps.x;
p.y = ph.y + pm.y + ps.y;
return p;
}

int main() {
while (1) {
scanf("%d", &l1);
if (l1 == -1)
break;
scanf("%d %d %d %d %d", &l2, &l3, &m1, &m2, &m3);
scanf("%d:%d:%d", &hh, &mm, &ss);
st = hh*3600 + mm*60 + ss;
scanf("%d:%d:%d", &hh, &mm, &ss);
ed = hh*3600 + mm*60 + ss;
Point p1, p2;
p1 = getpoint(st);
double ans = 0;
int i;
for (i = st+1; i <= ed; ++i) {
p2 = getpoint(i);
ans += getdis(p1, p2);
p1 = p2;
}
printf("%.2lf\n", ans/2);
}
return 0;
}


• 本文已收录于以下专栏：

举报原因： 您举报文章：hdoj 3209 Jumping Hands 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)