关于输入n个整数

关于输入n个整数

 

#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
int main()
{
    int t,sum=0,i=0,minn=INF,maxx=-INF;
    double ans;
    while(cin>>t)
    {  
        if(t>maxx)
        {
            maxx=t;
        }
        if(t<minn)
        {
            minn=t;
        }
        sum+=t;
        i++;
    }
    ans=(double)sum/i;
    cout<<minn<<" "<<maxx<<" ";
    printf("%.3lf",ans);
    return 0;
}

 

 

上一篇:[Luogu] CF509B Painting Pebbles


下一篇:每日一练:第十天——笨小猴