Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
128079 艾诗雯 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 188 2025-08-01 08:43:30

Tests(0/0):


Code:

int a; cin>>a; int b[a],d=0,e=10000; for(int i=0;i<a;i++) cin>>b[i]; for(int c=0;c<a;c++) { if(b[c]>d) d=b[c]; if(b[c]<e) e=b[c]; } cout<<d-e<<endl;


Run Info:

Main.cc:2:2: error: 'cin' does not name a type
  cin>>a;
  ^
Main.cc:3:9: error: array bound is not an integer constant before ']' token
  int b[a],d=0,e=10000;
         ^
Main.cc:4:2: error: expected unqualified-id before 'for'
  for(int i=0;i