Budget

Budget

Avin’s company has many ongoing projects with different budgets. His company records the budgets using numbers rounded to 3 digits after the decimal place. However, the company is updating the system and all budgets will be rounded to 2 digits after the decimal place. For example, 1.004 will be rounded down
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.

Input

The first line contains an integer n (1 ≤ n ≤ 1, 000). 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.

Output

Print the difference rounded to 3 digits..

Sample Input

1
1.001
1
0.999
2
1.001 0.999

Sample Output

-0.001
0.001
0.000

思路:看小数点后第三位的数,如果小于5就减去该数乘以0.001,如果大于等于5就加上(10减该数乘以0.001)。

 

#include<bits/stdc++.h>

using namespace std;
int main()
{
	int n;
	cin >> n;
	double ans = 0;
	while(n --){
	    string a;
	    cin >> a;
	    int l = a.length() ;
	    for(int i = 0;i < l;i ++){
		   if(a[i] == '.'){
			   if(a[i+3] - '0' <= 4) ans -= (a[i+3]-'0')*0.001;
			   else ans += (10 - (a[i+3]-'0'))*0.001; 
		   }
	    }  
	}
	printf("%.3lf\n",ans) ;
	return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Matlab是一种矩阵计算、数据分析和可视化的工具,并且也是ITU链路预算计算中常用的软件之一。 ITU链路预算计算是指在设计通信系统中,计算信号传输的距离、衰减和噪声等参数,以及预测接收端的信号强度和质量。这些参数对于通信系统设计的正确性和可行性至关重要。 对于ITU链路预算计算,Matlab提供了多种内置函数和工具箱,如通信工具箱、信号处理工具箱、无线通信工具箱等,可以方便地进行链路预算计算。此外,Matlab中的图形用户界面(GUI)也提供了一系列的可视化工具,帮助用户更直观地分析和比较数据结果。 总之,Matlab作为ITU链路预算计算中重要的工具之一,能够大大提高计算精度和效率,并且提供了多种可视化手段方便用户分析和展示计算结果。 ### 回答2: MATLAB itu-link budget是一种基于MATLAB平台的工具,用于计算和分析卫星通信链路预算。该工具主要用于分析和设计卫星通信中使用的天线、收发机、信号处理等各个环节的性能指标和参数,以实现卫星通信质量的最佳化。使用MATLAB itu-link budget,可以方便地进行频率规划、天线选型、功率分配、信噪比分析等工作,并对不同情况下的指标表现进行有效的评估和比较。此外,MATLAB itu-link budget不仅可以用于卫星通信系统的设计和优化,还可用于对实际卫星通信链路的性能进行监测和分析。通过实时获取系统数据并进行分析处理,能够及时发现问题并进行修复,提高卫星通信系统的稳定性和性能。因此,MATLAB itu-link budget是一种基于MATLAB的有效工具,可以为卫星通信系统的设计、优化和维护提供实用的支持和帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值