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. oracle查看锁和释放锁

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt108 Oracle数据库操作中,我们有时会用到锁表查询以及解锁和kill进程 ...

  2. C-C++到底支不支持VLA以及两种语言中const的区别

    C-C++到底支不支持VLA以及两种语言中const的区别 到底支不支持VLA VLA就是variable-length array,也就是变长数组. 最近写程序的时候无意间发现,gcc中竟然支持下面 ...

  3. C#之实参和形参

    1.值类型 例如:我们定义一个函数 static void Exchange(int x, int y) { int flag = x; flag = y; y = x; x = flag; } 其中 ...

  4. nrm的安装 、定义和用法

    因为npm包管理工具是属于国外的,所以在中国使用它下载东西的时候比较慢.这时我们就想用国内的淘宝镜像.也有别的,所以当你想切换下载源的时候就会用到nrm了. ###首先,nrm是什么呢? 开发的npm ...

  5. Spring mvc 转发、重定向

    spring控制器最后返回一个ModelAndView(urlName),其中urNamel可以是一个视图名称,由视图解析器负责解析后将响应流写回客户端;也可以通过redirect/forward:u ...

  6. Web in Linux小笔记001

    Linux灾难恢复: Root密码修复 Centos single Filesystem是硬盘文件根目录,无法再cd ..就像macitosh 硬盘图标 Pwd:显示绝对路径 MBR修复 模拟MBR被 ...

  7. 团队作业8——Beta 阶段冲刺6th day

    一.当天站立式会议 二.每个人的工作 (1)昨天已完成的工作(具体在表格中) 完善订单功能 (2)今天计划完成的工作(具体如下) 完善支付功能 (3) 工作中遇到的困难(在表格中) 成员 昨天已完成的 ...

  8. 微信小程序中的微信支付js代码和流程详解

    微信支付流程 步骤 (一)获取用户的信息 (二)统一下单(返回的prepay_id用于第(三)步的请求参数) (三)发起支付请求 操作(这边假设你已经获得了用户的openId) (一).获取用户ope ...

  9. 201521123058 java第六次作业

    1. 本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图,对面向对象思想进行一个总结. 2. 书面作业 1.clone方法 1.1 Object对 ...

  10. 201521123064 《Java程序设计》第6周学习总结

    1. 本章学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图,对面向对象思想进行一个总结. 注1:关键词与内容不求多,但概念之间的联系要清晰,内容覆盖 ...