hdu 3477 Temperature

 

Temperature

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 393    Accepted Submission(s): 143

Problem Description
Many people like summer as summer has a lot of advantages, but on the other hand, sometimes summer is also boring. As a student, Tom has complained with summer for many days. Because when having lunch, Tom has a habit of drinking soup. But the temperature of the soup is too high, so Tom need wait for a long time to drink. One day, Tom bought a bowl of soup again, he measured the temperature of the environment is ua and the temperature of the soup is u0, after t1 minutes, he measured the soup again and the temperature is u1, but he did not want to measure the temperature all the time until he could drink it. Now Tom asks you for help. Could you help Tom calculate what the temperature of the soup is after t2 minutes and how long he need to wait for until the temperature of the soup becomes u2 according to the data which he had measured? You could assume that the temperature of the environment is invariable.
 


 

Input
The first line of the input contains a single integer T (1 <= T <= 10), the number of test cases. Then T cases follow.
The first line of each case contains 5 integers, ua(0<ua<100), u0(ua<=u0<=100), u1(ua<=u1<=u0), t1(t1>0), n(1<=n<=10), indicating the temperature of the environment ua, the original temperature of the soup u0 and the later temperature of the soup u1 after t1 minutes, n indicates that there are n options in the following. Each line of the n lines contains two integers, p and s, p is the kind of the option and can only be 0 or 1. If p is 0, you should calculate the time Tom need to wait for until the temperature of the soup becomes s(ua<=s<=u0)(it is guaranteed that temperature s is reachable), or you should calculate the temperature of the soup after s(0<s<=100) minutes from original time t=0.
 


 

Output
For the x-th test case, first print “Case x:” on a single line.
Then for each option, print a line containing the answer round to two decimal numbers. Print a blank line after each test case.
 


 

Sample Input
  
  
1 24 100 90 10 2 0 80 1 20
 


 

Sample Output
  
  
Case 1: 21.65 81.32
Hint
According to Newton’s law of cooling, in a certain temperature range, the rate of change of an object’s temperature is proportional to the temperature difference of the object’s temperature and the environment temperature.
 


 

Author
ontheway
 


 

Source
 


 

Recommend
zhengfeng

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值