#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n, sum = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
int a;
cin >> a;
sum += a;
}
cout <<sum<<" "<<sum/n<<endl;
return 0;
}
时间: 2024-10-24 11:46:57
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n, sum = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
int a;
cin >> a;
sum += a;
}
cout <<sum<<" "<<sum/n<<endl;
return 0;
}