1
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
int max = -1;
for(int i = 0;i<n;i++)
{
int s;
cin>>s;
if(max<s)
{
max = s;
}
}
cout<<max;
return 0;
}
2
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
float min = 9999;
for(int i = 0;i<n;i++)
{
float s;
cin>>s;
if(min>s)
{
min = s;
}
}
cout<< min;
return 0;
}
3
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
int max = -1;
int min = 9999;
for(int i = 0;i<n;i++)
{
int s;
cin>>s;
if(max<s)
{
max = s;
}
if(min>s)
{
min = s;
}
}
cout<<max - min;
return 0;
}
4
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
int sum = 0;
for(int i = 0;i<n;i++)
{
int s;
cin>>s;
sum = sum + s;
}
cout<<sum/n;
return 0;
}
5
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
int sum = 0;
int cut = 0;
for(int i = 0;i<n;i++)
{
int s;
cin>>s;
if(s>=80)
{
sum = sum + s;
cnt++;
}
}
cout<<cnt<<endl;
cout<<sum/cnt;
return 0;
}
10.15作业
最新推荐文章于 2024-08-16 16:51:12 发布