注:此为c++代码
虽然我的代码无注释,但如想复制,必须完全搞懂代码所对应的题!
Dev c++这东西点进来的都有吧,详情见我的另一篇文章。
正式进入题解部分: (本人小白,大佬们请勿吐槽)
1059:
#include<bits/stdc++.h>
using namespace std;
double c,d;
int a,b=1;
int main()
{
cin>>a;
while(b<=a)
{
cin>>c;
d+=c;
b++;
}
cout<<fixed<<setprecision(2)<<d/a<<endl;
return 0;
}
1060:
#include<bits/stdc++.h>
using namespace std;
double c,d;
int a,b=1;
int main()
{
cin>>a;
while(b<=a)
{
cin>>c;
d+=c;
b++;
}
cout<<fixed<<setprecision(4)<<d/a<<endl;
return 0;
}
1061:
#include<bits/stdc++.h>
using namespace std;
double c,d;
int a,b=1;
int main()
{
cin>>a;
while(b<=a)
{
cin>>c;
d+=c;
b++;
}
cout<<d<<" "<<fixed<<setprecision(5)<<d/a<<endl;
return 0;
}
1062:
#include<bits/stdc++.h>
using namespace std;
int n,a,i,x=0;
int main()
{
scanf("%d",&n);
scanf("%d",&a);
x=a;
for(i=2;i<=n;i++)
{
scanf("%d",&a);
if(a>x)
{
x=a;
}
}
printf("%d",x);
return 0;
}
1063:
#include<bits/stdc++.h>
using namespace std;
int a,b,maxx=0,minn=1000;
int main()
{
cin>>a;
for(int i=1;i<=a;i++)
{
cin>>b;
if(b>=maxx)
{
maxx=b;
}
if(b<=minn)
{
minn=b;
}
}
cout<<maxx-minn;
return 0;
}
1064:
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e=0,f=0,g=0;
int m