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. mvc中html导出成word下载-简单粗暴方式

    由于工作需求,需要把html简历页导出成word下载.网上搜索了很多解决方案,基本都是用一些插件,然后写法也很麻烦,需要创建模板什么的. 固定替换值  代码一大堆.但是对于我的需求来说  并没有什么用 ...

  2. 主从及转发DNS搭建

    author:JevonWei 版权声明:原创作品 主DNS 安装bind软件包 yum -y install bind systemctl start named systemctl enable ...

  3. 运行mvn install时跳过Test

    1.1 方法一 <project> [...] <build> <plugins> <plugin> <groupId>org.apache ...

  4. java 8 总结 之lambda

    lambda表达式 目的:行为参数化 Lambda表达式是简洁地表示可传递的匿名函数的一种方式:它没有名称,但它有参数列表.函数主体.返回类型,可能还有一个可以抛出的异常列表. Lambda的基本语法 ...

  5. Unity相对于Cocos2d-x的比较

    1.unity:Code in C# or js       cocos:(Code in C++) 2.unity:可以让美工.动画.码农在同一个平台上各司其职(一起玩)       cocos:码 ...

  6. Tinyhttpd 代码学习

    前阵子,参加了实习生面试,被面试官各种虐,问我说有没有读过一些开源的代码.对于只会用框架的我来说真的是硬伤啊,在知乎大神的推荐下在EZLippi-浮生志找了一些源代码来阅读,于是从小型入手,找了Tin ...

  7. 关于javascript原型链的个人理解

    首先js是一种面对对象的语言,虽然大多数时候是以面对过程的形式展现出来.先来看一段代码: function Base() { this.name = 'tarol'; } function Sub() ...

  8. 用shell批量编码转换

    -------------------------------------文件内容转换:iconv-------------------------------------- 通常,从其他平台拷贝过来 ...

  9. 【★】IT界8大恐怖预言

    IT界的8大恐怖预言 本文字数:3276 建议阅读时间:你开心就好 第三次科技革命已经进入白热化阶段---信息技术革命作为其中最主要的一环已经奠定了其基本格局和趋势.OK大势已定,根据目前的形势,小编 ...

  10. unity3D HTC VIVE开发-物体高亮功能实现

    在VR开发时,有时需要用到物体高亮的功能.这里使用Highlighting System v3.0.1.unitypackage插件实现. Highlighting System v3.0.1的介绍访 ...