Temperature

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

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.

 
 
这么水的积分,竟然不会做,唉。。。。。。。。。
 #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#define eps1 0.000000001
using namespace std;
int main()
{
double ua,u0,u1,t1,c,k,y;
int n,i,t,x,cas=;
scanf("%d",&t);
while(t--)
{
printf("Case %d:\n",cas++);
cin>>ua>>u0>>u1>>t1>>n;
c=log(u0-ua);
k=(log(u1-ua)-c)/t1;
for(i=;i<n;i++)
{
cin>>x>>y;
if(x)
{
if(ua==u0)
printf("%.2lf\n",ua);
else
printf("%.2lf\n",ua+exp(k*y+c));
}
else
{
if(ua==u0)
printf("%.2lf\n",0.0);
else
printf("%.2lf\n",(log(y-ua)-c)/k);
}
}
cout<<endl;
}
}
 

Temperature hdu 3477的更多相关文章

  1. HDU 6012 Lotus and Horticulture(离散化)

    题目代号:HDU 6012 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6012 Lotus and Horticulture Time Limit: ...

  2. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  3. [LeetCode] Rising Temperature 上升温度

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. 实现点击后创建div,若对div2秒无操作则将div隐藏,鼠标移上div让它不隐藏,移出div超过两秒则div隐藏

    $('.addLabel').on('click', function () { setTimeout(function(){ if(hoverflag==0){ $(".labelHide ...

  2. CAP和BASE理论

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt370 1. CAP理论 2000年7月,加州大学伯克利分校的Eric Bre ...

  3. Python终端输出打印彩色字体的方法

    一  实现过程 终端的字符颜色是用转义序列控制的,是文本模式下的系统显示功能,和具体的语言无关. 转义序列是以ESC开头,即用\033来完成(ESC的ASCII码用十进制表示是27,用八进制表示就是0 ...

  4. 【1414软工助教】博客链接和coding链接

    某些同学提供的coding.net用户名无法访问.请同学们自己点击自己的两个链接,如果发现有错,请在本博客的评论区给出正确的链接. 格式为: 学号后3位 链接 例如:***502 https://co ...

  5. 团队作业8——Beta 阶段冲刺1st day

    一.今日站立式会议照片 二.每个人的工作 (1) 昨天已完成的工作: 今天是冲刺的第一天,昨天完成的是团队成员任务的分配 (2) 今天计划完成的工作: 界面的完善 (3) 工作中遇到的困难: 对于界面 ...

  6. Eclipse安装完findbugs插件后,SVN插件不可用有关问题解决

    Eclipse安装完findbugs插件后,SVN插件不可用问题解决: 安装findbugs插件后,SVN插件就消失了.后来从网上查到解决方案:eclipse/configuration目录下的org ...

  7. 201521123095 《Java程序设计》第7周学习总结

    1. 本章学习总结 **2. 书面作业* 1.ArrayList代码分析 1.1 解释ArrayList的contains源代码 该源代码验证该ArrayList中是否包含某个对象,contains的 ...

  8. 201521123014 《Java程序设计》第5周学习总结

    1. 本周学习总结 1.1 尝试使用思维导图总结有关多态与接口的知识点. 2. 书面作业 Q1. 代码阅读:Child压缩包内源代码 1.1 com.parent包中Child.java文件能否编译通 ...

  9. 201521123077 《Java程序设计》第13周学习总结

    1. 本周学习总结 1.1以你喜欢的方式(思维导图.OneNote或其他)归纳总结多网络相关内容. 介绍的传输层协议 : TCP 可靠:具有失败重传功能 开销较大:需要建立链路 需要维持传输中的关系 ...

  10. 201521123059 《Java程序设计》第十周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常与多线程相关内容. 多线程的相关理解图: 2. 书面作业 本次PTA作业题集异常.多线程 Q1:finally 题目4-2 1. ...