Accepted
foo.cc: In function 'int main()': foo.cc:5:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] int n,*a;scanf("%d",&n); ~~~~~^~~~~~~~~
正在同步测试数据,请稍后 自豪的采用HydroJudge(https://github.com/hydro-dev/Hydro)进行评测。
代码
#include<iostream>
using namespace std;
int main()
{
int n,*a;scanf("%d",&n);
a=new int [n];
for(int i=0;i<n;i++) cin>>a[i];
int max=a[0];
for(int i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
}
printf("%d\n",max);
int min=a[0];
for(int i=0;i<n;i++)
{
if(a[i]<min)
min=a[i];
}
printf("%d\n",min);
int sum=0;
for(int i=0;i<n;i++) sum+=a[i];
printf("%d\n",sum);
return 0;
}