Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147597 鸡哥 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 234 2026-02-06 13:51:33

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[10001],b,d,x; cin>>b; cin>>a[1]; x = d = a[1] for(int i = 2;i<=b;i++){ cin>>a[i]; if(a[i] > x)x=a[i]; if(a[i] < b)b = a[i]; } cout<<(x-b); }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:2: error: expected ';' before 'for'
  for(int i = 2;i<=b;i++){
  ^
Main.cc:8:16: error: 'i' was not declared in this scope
  for(int i = 2;i<=b;i++){
                ^