Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
5272 温翰麒 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 470 2024-11-09 14:27:47

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 int m,a[10010],minn=10010,maxn=-10010; cin>>m; int main(){ cin>>m; for(int i=1;i<=m;i++){ cin>>a[i]; if(maxn<a[i])maxn=a[i]; if(minn>a[i])minn=a[i]; } cout<<maxn-minn<<endl; return 0; }


Run Info:

Main.cc:7:5: error: two or more data types in declaration of 'm'
 int m,a[10010],minn=10010,maxn=-10010;
     ^
Main.cc:7:14: error: two or more data types in declaration of 'a'
 int m,a[10010],minn=10010,maxn=-10010;
              ^
Main.cc:7:16: error: two or more data types in declaration of 'minn'
 int m,a[10010],minn=10010,maxn=-10010;
                ^
Main.cc:7:27: error: two or more data types in declaration of 'maxn'
 int m,a[10010],minn=10010,maxn=-10010;
                           ^
Main.cc:8:1: error: 'cin' does not name a type
 cin>>m;
 ^
Main.cc: In function 'int main()':
Main.cc:10:10: error: 'm' was not declared in this scope
     cin>>m;
          ^
Main.cc:12:10: error: 'a' was not declared in this scope
     cin>>a[i];
          ^
Main.cc:13:8: error: 'maxn' was not declared in this scope
     if(maxna[i])minn=a[i];
        ^
Main.cc:16:11: error: 'maxn' was not declared in this scope
     cout<maxn-minn<<endl;
           ^
Main.cc:16:16: error: 'minn' was not declared in this scope
     cout<<maxn-minn<<endl;
                ^