Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
65588 胡家豪 07切比雪夫距离 C++ Compile Error 0 MS 0 KB 305 2024-01-26 12:53:03

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d; int a=0,b=0; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>b){ n=a-b; }else{ n=b-a; } if(c>d){ z=c-d; }else{ z=d-c; } if(n>z){ printf("%d",n); }else{ printf("%d",z); } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:9: error: redeclaration of 'int a'
     int a=0,b=0;
         ^
Main.cc:5:9: note: 'int a' previously declared here
     int a,b,c,d;
         ^
Main.cc:6:13: error: redeclaration of 'int b'
     int a=0,b=0;
             ^
Main.cc:5:11: note: 'int b' previously declared here
     int a,b,c,d;
           ^
Main.cc:9:6: error: 'n' was not declared in this scope
      n=a-b;
      ^
Main.cc:11:3: error: 'n' was not declared in this scope
   n=b-a;
   ^
Main.cc:14:3: error: 'z' was not declared in this scope
   z=c-d;
   ^
Main.cc:16:3: error: 'z' was not declared in this scope
   z=d-c;
   ^
Main.cc:18:5: error: 'n' was not declared in this scope
  if(n>z){
     ^
Main.cc:18:7: error: 'z' was not declared in this scope
  if(n>z){
       ^
Main.cc:7:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d%d",&a,&b,&c,&d);
                                  ^