A Simple Question of Chemistry


Time Limit: 2 Seconds      Memory Limit: 65536 KB

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.


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

分析:我只要前一个数,和当前的数就行了,就要想办法循环起来。不用容器存起来,当然用容器全部存起来在做也可以

 #include <iostream>
using namespace std;
int main(){
cout.precision();
double pre, cur;
cin >> pre;
if(pre == ){
cout << "End of Output" << endl;
return ;
}
while(cin >> cur){
if(cur == ){
cout << "End of Output" << endl;
break;
}
cout << fixed << (cur - pre) << endl;
pre = cur;
}
//system("pause");
return ;
}

zoj 1763 A Simple Question of Chemistry的更多相关文章

  1. A Simple Question of Chemistry

    #include<stdio.h> int main() { int i, l; ]; ]; l = ; ) { l++; } ; a[i]!= && i<l; i+ ...

  2. YTU 2900: F-A Simple Question

    2900: F-A Simple Question 时间限制: 1 Sec  内存限制: 128 MB 提交: 66  解决: 24 题目描述 今天,pasher打算在一个浪漫的花园和他的搭档们聚餐, ...

  3. ZOJ 3686 A Simple Tree Problem

    A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each no ...

  4. zoj 3286 Very Simple Counting---统计[1,N]相同因子个数

    Very Simple Counting Time Limit: 1 Second      Memory Limit: 32768 KB Let f(n) be the number of fact ...

  5. zoj 3686 A Simple Tree Problem (线段树)

    Solution: 根据树的遍历道的时间给树的节点编号,记录下进入节点和退出节点的时间.这个时间区间覆盖了这个节点的所有子树,可以当做连续的区间利用线段树进行操作. /* 线段树 */ #pragma ...

  6. Simple Question

    一.你会在时间序列数据集上使用什么交叉验证技术?是用k倍? 答:都不是.对于时间序列问题,k倍可能会很麻烦,因为第4年或第5年的一些模式有可能跟第3年的不同,而我们最终可能只是需要对过去几年的进行验证 ...

  7. ZOJ 3686 A Simple Tree Problem(线段树)

    Description Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the ...

  8. K Simple question (第十届山东理工大学ACM网络编程擂台赛 正式赛)

    题解:素数筛+唯一分解定理 可以把素数筛那部分放到while之外,减小时间复杂度. #include <stdio.h> #include <stdlib.h> #includ ...

  9. Functional Programming without Lambda - Part 1 Functional Composition

    Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had lon ...

随机推荐

  1. Saltstack学习笔记--安装

    实验环境: 两台RHEL 7.2 192.168.75.135          master .minion 192.168.75.136          minion 确保机器的防火墙及seli ...

  2. 【学习笔记】彻底理解JS中的this

    首先必须要说的是,this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到底指向谁,实际上this的最终指向的是那个调用它的对象(这句话有些问题,后面会解释为什么会有问题,虽然 ...

  3. JavaScript创建对象的七种方法

    一. 工厂模式 创建: function createPerson(name,behavior){ var p=new Object(); p.name=name; p.behavior=behavi ...

  4. Java&Xml教程(十)XML作为属性文件使用

    我们通常会将Java应用的配置参数保存在属性文件中,Java应用的属性文件可以是一个正常的基于key-value对,以properties为扩展名的文件,也可以是XML文件. 在本案例中,將会向大家介 ...

  5. VC++编译出错:LNK1123: 转换到 COFF 期间失败: 文件无效或损坏

    解决方法: 1.搜索C盘下的cvtres.exe,结果得到类似这样的列表: C:\Program Files\Microsoft Visual Studio 10.0\VC\bin C:\Window ...

  6. Android自定义zxing扫描界面的实现

    首先,我们需要导入zxing的jar文件,其次复制所需要的资源文件以及放入自己需要添加的资源文件,复制出源码的必要相关类文件.对布局文件进行一定的修改,再修改CaptureActivity与Viewf ...

  7. COGS 2685. 迷妹

    ★   输入文件:fans.in   输出文件:fans.out   简单对比时间限制:1 s   内存限制:256 MB [题目描述] 小钟.小皓和小曦都是著名偶像派OI选手,他们都有很多迷妹. 现 ...

  8. 洛谷 P1006 传纸条

    题目描述 小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题.一次素质拓展活动中,班上同学安排做成一个m行n列的矩阵,而小渊和小轩被安排在矩阵对角线的两端,因此,他们就无法直接交谈了.幸运的是 ...

  9. COGS 886. [USACO 4.2] 完美的牛栏

    ★★☆   输入文件:stall4.in   输出文件:stall4.out   简单对比时间限制:1 s   内存限制:128 MB USACO/stall4(译by Felicia Crazy) ...

  10. (2)Ngixn 编译安装设置开机自启

    设置nginx开机自启 #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 ...