G - Grade Point Average

As soon as Moca entered the university last year as a freshman, she was told that the competition is fierce and everyone was desperately trying to improve their grades. As a result, in the last academic term, Moca studied just as hard as she did in high school.

The college will award scholarships based on the average score of the previous academic term. Unfortunately, someone has the same average score as Moca because the average score is calculated rounding down to only 1 decimal places. For example, Ran's average score is 48/5≈9.6 and Moca's average score is 29/3≈9.6, but apparently Moca's average score is higher.

Can you help Moca calculate her average score rounding down to k decimal places?

Input

The first line contains two integers n,k (1≤n,k≤105) – the number of courses and the number of decimal places.

The second line contains n integers a1,a2,…,an(0≤ai≤100) – the score of each course.

Output

Print one real number in a line that denotes Moca's average score. Notice that your answer must contain k decimal places.

Examples

InputcopyOutputcopy
3 10
94 100 99
97.6666666666
#include<stdio.h>
int main()
{
    int n,k,w=0,a,y;
    scanf("%d%d",&n,&k);
    int b=n;
    while(n--)
    {
        scanf("%d",&a);
        w+=a;
    }
    printf("%d.",w/b);//整数部分 
    while(k--)
    {
        int x=w%b;//小数部分 
        x*=10;
        w=x;
        x/=b;
        printf("%d",x);
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值