I chose this one randomly from Algorithmist
____________________________________________________________________
Question: Euclidian Clock
____________________________________________________________________
#include "iostream.h"
#include "math.h"
#include "iomanip.h"
int main() {
double d, h, m, s, u;
double hrs1, hrs2, pi = 2*acos(0), ans, area, r;
cin >> d;
for(int i = 1; i <= d; i++) {
cin >> h>> m>> s >> u;
hrs1 = h + m/60 + s/3600 + u/360000;
cin >> h>> m>> s >> u;
hrs2 = h + m/60 + s/3600 + u/360000;
cin >> r;
area = pi * r * r;
ans = (hrs2 - hrs1)/12 * area;
cout << i << ". " << fixed << setprecision(3) << ans << endl;
}
return 0;
}
____________________________________________________________________
Monday, October 8, 2007
Euclidian Clock
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment