Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6753 詹梓涵 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 500 2025-03-15 10:31:11

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[10001],m,a=-10001,b=10001; cin>>m; for(int i=1;i<=m;i++){ cin>>a[i]; if(a[i]>a){ a=a[i]; } if(a[i]<b){ b=a[i]; } } cout<<a-b<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:20: error: conflicting declaration 'int a'
     int a[10001],m,a=-10001,b=10001;
                    ^
Main.cc:7:9: error: 'a' has a previous declaration as 'int a [10001]'
     int a[10001],m,a=-10001,b=10001;
         ^
Main.cc:11:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
         if(a[i]>a){
                 ^
Main.cc:12:14: error: incompatible types in assignment of 'int' to 'int [10001]'
             a=a[i];
              ^