hdu6575Budget
to 1.00 while 1.995 will be rounded up to 2.00. Avin wants to
know the difference of the total budget caused by the update.
The second line contains n decimals, and the i-th decimal ai (0 ≤ ai ≤ 1e18)
represents the budget of the i -th project. All decimals are rounded to 3
digits.
1.001
1
0.999
2
1.001 0.999
0.001
0.000
#include<iostream>
using namespace std;
int main(){
int n,a;
double s1=0,s2=0,val;
char c;
cin>>n;
for(int i=0;i<n;i++){
while(1){
cin>>c;
if(c=='.') break;
}
a=0;
for(int j=0;j<3;j++){
cin>>c;
a=a*10+c-'0';
}
val=a;
val/=1000;
s1+=val;
if(a%10>=5){
a=a/10;
a++;
}
else
a=a/10;
val=a;
val/=100;
s2+=val;
}
printf("%.3f\n",s2-s1);
return 0;
}
hdu6575Budget的更多相关文章
随机推荐
- 生产者消费者模型(JoinableQueue)
- QT中使用Event Filter监听button事件,Release后button不见
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zhenyu5211314/article/details/27201043 问题RT,在程序中我使用 ...
- .NET Core _linux sdk安装
根据官方介绍页面的步骤: 步骤1. sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/do ...
- v-cloak解决Vue双大括号闪烁问题
相信不少人和我一样,初次查看一个技术的文档的时候,知识吸收的很慢,因为对这个技术的不熟悉导致不清楚各种操作的应用场景,当我意识到这件事之后,我决定换种学习思路,即以实战为主,卡壳就查文档,会对这个技术 ...
- 调用SM30数据表维护的函数
相关文章:http://www.cnblogs.com/caizjian/p/3248499.html 1.se11进去新建一个数据表 2.se55进去生产表维护 3.sm30进去维护数据表 4.se ...
- 2018-8-10-C#-ValueTuple-原理
title author date CreateTime categories C# ValueTuple 原理 lindexi 2018-08-10 19:16:52 +0800 2018-2-13 ...
- 认知redis
一.redis是什么? 1.基于key-value的内存No sql 数据库(非关系型数据库) 2.读写性能非常好 二.redisd的数据类型有哪些?特点分别是什么? 1)string 一个键对一个值 ...
- 【改】utf-8 的去掉BOM的方法
最近在测试中发现,linux系统中导出的文件,有记事本打开另存为或者保存后,再次导入进linux系统,发现失败了,对比文件内容,没发现区别,打开二进制文件对比发现,文件头部多了三个字符:EF BB B ...
- 采集容器内存并写到excel
# coding=utf-8 import os import commands import re from pyExcelerator import * def execute(cmd): sta ...
- bzoj4002 [JLOI2015]有意义的字符串 特征根+矩阵快速幂
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=4002 题解 神仙题. 根据下面的一个提示: \[ b^2 \leq d \leq (b+1)^ ...