poj2871 A Simple Question of Chemistry
来源:互联网 发布:java加法程序 编辑:程序博客网 时间:2024/05/03 02:49
A Simple Question of Chemistry
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6666 Accepted: 4426
Description
Your chemistry lab instructor is a very enthusiastic graduate student who clearly has forgotten what their undergraduate Chemistry 101 lab experience was like. Your instructor has come up with the brilliant idea that you will monitor the temperature of your mixture every minute for the entire lab. You will then plot the rate of change for the entire duration of the lab.
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.
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.012.0530.2520999
Sample Output
2.0518.20-10.25End of Output
水!!!
参考代码:
#include<stdio.h>int main(){ double n,n1; scanf("%lf",&n); while(n!=999) { scanf("%lf",&n1); if(n1!=999) printf("%.2f\n",n1-n); n=n1; } printf("End of Output\n"); return 0;}
0 0
- poj2871 A Simple Question of Chemistry
- poj2871 A Simple Question of Chemistry(水题)
- zoj 1763 A Simple Question of Chemistry
- zoj 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
- zoj 1763.A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry
- 1763 A Simple Question of Chemistry
- poj 2871 A Simple Question of Chemistry
- poj 2871 A Simple Question of Chemistry
- zoj 1763 A Simple Question of Chemistry(洪水!)
- POJ 2871 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(水~)
- POJ 2871 A Simple Question of Chemistry G++
- UVA 825 Walking on the Safe Side
- IOS学习笔记 第7篇 内存管理
- JavaWeb_请求转发与重定向
- osg学习第三篇:碰撞检测(一)
- 通过一个小例子了解RPC
- poj2871 A Simple Question of Chemistry
- Android Studio 初装常见问题
- Change request, Corrective Actions, and Preventive actions, Defect Repair
- UVA 10069 Distinct Subsequences
- HDU 1203 I NEED A OFFER!
- TIZEN 系统的演化
- HDU1867:A + B for you again(KMP)
- hdu 1217 Arbitrage 两种算法AC代码,Floyd+Bellman-Ford 大水题一枚 注意是有向图~~
- poj2845 01000001