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. Outlook读取奇妙清单Wunderlist日历失败的解决办法

    错误: Outlook.com日历订阅奇妙清单的日历链接时报错 This calendar wasn't updated because of a problem with the publisher ...

  2. PL/SQL笔记(1)-流程控制,循环,异常,块

    流程控制 1.If,then,else,elsif(不是elseif) ' then null; endif; 2.Case 简单case表达式: 搜索型Case表达式: 3.goto语句 begin ...

  3. lock和synchronized的同步区别与选择

    1. lock是一个接口,而synchronized是java的一个关键字,synchronized是内置的语言实现:(具体实现上的区别在<Java虚拟机>中有讲解底层的CAS不同,以前有 ...

  4. java课程设计全程实录——第0天

    本次课设计划在5月25日完成.目前还剩18天. 第0天主要完成事项如下: 搭建开发环境 制定开发进度规划表 阅读前人的课设 详细: 1.IDE的下载,安装,以及配合使用的阿里巴巴编程规约插件的安装与测 ...

  5. Java并发——ThreadPoolExecutor线程池解析及Executor创建线程常见四种方式

    前言: 在刚学Java并发的时候基本上第一个demo都会写new Thread来创建线程.但是随着学的深入之后发现基本上都是使用线程池来直接获取线程.那么为什么会有这样的情况发生呢? new Thre ...

  6. random模块详解

    1.import random random·randint(a,b) 括号里是一个范围,random·randint()是取括号里范围的随机数. >>> import random ...

  7. configure: error: The LBL Packet Capture Library, libpcap, was not found!

    configure: error:  The LBL Packet Capture Library, libpcap, was not found! yum install libpcap*

  8. java实现批量修改指定文件夹下所有后缀名的文件为另外后缀名的代码

    java实现批量修改指定文件夹下所有后缀名的文件为另外后缀名的代码 作者:Vashon package com.ywx.batchrename; import java.io.File; import ...

  9. element ui select组件和table做分页完整功能和二级联动效果

    <template> <div class="index_box"> <div class="search_box"> &l ...

  10. 初次改app

    没有学过安卓,突然需要改app里的一个bug,一个没搞过安卓的人要怎么入手去改这个安卓的代码呢?下面看看我入手的步骤 首先,页面上有几个文字“曲线分析”,那么在项目里找到这个文字,就可以找到这个页面的 ...