poj 2555 Drink, on Ice 物理坐标计算
来源:互联网 发布:数据分析实验室 编辑:程序博客网 时间:2024/06/03 08:16
题意:
把一些冰和一些水混合,求最终的状态和温度。
分析:
质量守恒+能量守恒。计算时将整条曲线平移至(0,0)开始会比较方便,但是发现当Q=0时T=-30,引入新的横坐标dT=T+30,曲线就从(Q,dT)==(0,0)开始了。
代码:
//poj 2555//sep9#include <iostream>#include <cmath>using namespace std;const double cw=4.19,ci=2.09,em=335;int main(){double mw,mi,tw,ti;while(1){scanf("%lf%lf%lf%lf",&mw,&mi,&tw,&ti);if(fabs(mw+mi)<1e-6)break;double Q;Q=mw*(ci*30+em+cw*tw)+mi*ci*(30+ti);double m=(mw+mi);if(m*ci*30>Q){double T=Q/m/ci-30;printf("%.1lf g of ice and 0.0 g of water at %.1lf C\n",m,T);}else if(m*(ci*30+em)<Q){double T=(Q-m*(ci*30+em))/m/cw;printf("0.0 g of ice and %.1lf g of water at %.1lf C\n",m,T);}else{Q-=m*ci*30;double x=Q/em;printf("%.1lf g of ice and %.1lf g of water at 0.0 C\n",m-x,x);}}return 0;}
0 0
- poj 2555 Drink, on Ice 物理坐标计算
- HOJ 1526 Drink, on Ice
- 物理坐标与逻辑坐标
- ICE网格计算
- 相机坐标,图像坐标,大地物理坐标
- poj 2660 War on Weather 计算几何
- POJ 1099 Square Ice
- poj 1099 Square Ice
- poj 2002(全等三角形计算正方形另外两个点坐标)
- poj-1408-计算两线相交点坐标模板
- On thin ice 处境危险
- 物理与渲染坐标研究
- poj 1099 Square Ice 模拟
- POJ 3097 Falling Ice 笔记
- 设备坐标、逻辑坐标、物理坐标的区别与转换
- POJ 1657 Distance on Chessboard 简单的计算问题
- 用坐标计算里程
- JavaScript 坐标计算
- 【高效算法设计——滑动窗口】 UVa 12174 Shuffle
- wpf 进度条 ProgressBar的使用
- Sass和Compass的神秘面纱
- DEDE发生Fatal error: Call to a member function read() on a non-object in 错误解决方法
- JSP环境集成包 工具
- poj 2555 Drink, on Ice 物理坐标计算
- 编码实践五要诀
- C++学习之【使用位操作符求素数分析】
- MINA源码简易剖析(一)
- Java学习之-动态编译-DynamicCompile_反射调用
- ios开发-OC的初步学习
- #define XXX do{ XXX } while(0) 为什么会有这种用法
- android IntentService生命周期问题
- 就这么开始吧