1763_A Simple Question of Chemistry
来源:互联网 发布:用雪糕棍做房子数据 编辑:程序博客网 时间:2024/06/11 02:27
Being a promising computer scientist, you know you can automate part of this procedure, so you are writing a program you can run on your laptop during chemistry labs. (Laptops are only occasionally dissolved by the chemicals used in such labs.) You will write a program that will let you enter in each temperature as you observe it. The program will then calculate the difference between this temperature and the previous one, and print out the difference. Then you can feed this input into a simple graphing program and finish your plot before you leave the chemistry lab.
Input
The input is a series of temperatures, one per line, ranging from -10 to 200. The temperatures may be specified up to two decimal places. After the final observation, the number 999 will indicate the end of the input data stream. All data sets will have at least two temperature observations.
Output
Your program should output a series of differences between each temperature and the previous temperature. There is one fewer difference observed than the number of temperature observations (output nothing for the first temperature). Differences are always output to two decimal points, with no leading zeroes (except for the ones place for a number less than 1, such as 0.01) or spaces.
After the final output, print a line with "End of Output"
Sample Input
10.0
12.05
30.25
20
999
Sample Output
2.05
18.20
-10.25
End of Output
Source: Mid-Atlantic USA 2003
××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
double a,b;
bool flag=true;
while(cin>>a&&a!=999)
{
if(flag)
flag=false;
else
cout<<setiosflags(ios::fixed)<<setprecision(2)<<a-b<<endl;//控制小数点后为两位
b=a;
}
cout<<"End of Output"<<endl;
return 0;
}
- 1763_A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry
- ZOJ 1763 A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry
- 1763 A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry(洪水!)
- ZOJ 1763: A Simple Question of Chemistry 【位数问题setprecision】
- ZOJ Problem Set - 1763 A Simple Question of Chemistry
- poj 2871 A Simple Question of Chemistry
- zoj1763-----------A Simple Question of Chemistry
- zoj 1763.A Simple Question of Chemistry
- poj2871 A Simple Question of Chemistry
- poj 2871 A Simple Question of Chemistry
- poj 2871 A Simple Question of Chemistry
- POJ 2871 A Simple Question of Chemistry(水题)
- POJ 2871 A Simple Question of Chemistry(水~)
- POJ 2871 A Simple Question of Chemistry G++
- Sql Server中批量更新某一已经有值的字段为Null(实例)!
- Spring MVC
- 重定向和转发的区别
- hdu 2571 命运
- 算法的时间复杂度和空间复杂度
- 1763_A Simple Question of Chemistry
- 注意Integer和int的用法
- AcMore-1493(划分问题)
- umount: /mnt/cdrom: device is busy
- 2013年4月14日 22:46:03
- Java多线程技术初识——3. 线程安全问题
- AJAX笔试面试题
- windows下GSL的配置
- java参数传递