标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16633 Accepted Submission(s): 4059
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const double h_m=11.0/120,h_s=719.0/120,m_s=59.0/10; //相对角速度 const double Th_m=43200.0/11,Th_s=43200.0/719,Tm_s=3600.0/59; //周期 int main() { double d; while(scanf("%lf",&d)!=EOF&&d>=0) { ///d/h_m double sh_m=d/h_m; double eh_m=(360.0-d)/h_m; double sh_s=d/h_s; double eh_s=(360.0-d)/h_s; double sm_s=d/m_s; double em_s=(360.0-d)/m_s; double s1,e1,s2,e2,s3,e3,s4,e4,res=0; for(s1=sh_m,e1=eh_m;e1<=43200.000001;s1+=Th_m,e1+=Th_m) { for(s2=sh_s,e2=eh_s;e2<=43200.000001;s2+=Th_s,e2+=Th_s) { if(e1<=s2) break; if(e2<=s1) continue; for(s3=sm_s,e3=em_s;e3<=43200.000001;s3+=Tm_s,e3+=Tm_s) { if(s3>=e2||s3>=e1) break; if(e3<=s2||e3<=s1) continue; s4=max(s1,max(s2,s3)); e4=min(e1,min(e2,e3)); res+=(e4-s4); } } } printf("%.3lf\n",res/432); } return 0; }
标签:
原文地址:http://www.cnblogs.com/jasonlixuetao/p/5443931.html