#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
using namespace std;
int a_sum(vector<int> a)
{
int sum = 0;
for (auto r : a)
{
if (r % 2 == 0)
{
sum = sum + r;
}
}
return sum;
}
int a_jc(vector<int> a)
{
int jc = 0;
int sign = 1;
for (auto r : a)
{
jc = jc + sign*r;
sign = -sign;
}
return jc;
}
int a_count(vector<int> a)
{
return a.size();
}
double a_aver(vector<int> a)
{
double sum = 0.0;
for (auto r : a)
{
sum = sum + r;
}
return sum / static_cast<double>(a.size());
}
int a_max(vector<int> a)
{
int max = 0;
for (auto r : a)
{
if (r >= max)
max = r;
}
return max;
}
int main()
{
vector<int> a1, a2, a3, a4, a5;
unsigned n = 0;
unsigned tmp;
cin >> n;
while (n > 0 && cin >> tmp)
{
switch (tmp%5)
{
case 0:
a1.push_back(tmp);
break;
case 1:
a2.push_back(tmp);
break;
case 2:
a3.push_back(tmp);
break;
case 3:
a4.push_back(tmp);
break;
case 4:
a5.push_back(tmp);
break;
}
--n;
}
if (a1.size() > 0 && a_sum(a1)!=0)
cout << a_sum(a1) << " ";
else
cout << "N" << " ";
if (a2.size() > 0)
cout << a_jc(a2) << " ";
else
cout << "N" << " ";
if (a3.size() > 0)
cout << a_count(a3) << " ";
else
cout << "N" << " ";
if (a4.size() > 0)
{
cout.setf(ios::fixed);
cout << setprecision(1) << a_aver(a4) << " ";
}
else
cout << "N" << " ";
if (a5.size() > 0)
cout << a_max(a5);
else
cout << "N";
system("pause");
return 0;
}
网友评论