题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4530
题意:
中文题目,就是求3种情况的的值。
参考代码:
#include <stdio.h>
double x,k;
int main()
{
int t,q,temp;
double ans;
double run1();
double run2();
double run3();
while(~scanf("%d",&t))
{
while(t--)
{
scanf("%lf %d",&x,&q);
while(q--)
{
scanf("%d%lf",&temp,&k);
if(temp==1)
ans=run1();
else if(temp==2)
ans=run2();
else if(temp==3)
ans=run3();
printf("%.2lf\n",ans);
}
}
}
return 0;
}
double run1(){
return (60-x)*k;
}
double run2(){
return k*3600/(60-x);//大笨钟走的时间是3600*k,而正常的话走的速度比大笨钟要快,时间就比大笨钟的要短,所以用除的
}
double run3(){
return 3600*12*60*k/x;
}