Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
65590 邓嘉懿 07切比雪夫距离 C++ Compile Error 0 MS 0 KB 306 2024-01-26 12:54:52

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:15: error: redeclaration of 'int y2'
  int x1,x2,y2,y2;
               ^
Main.cc:4:12: note: 'int y2' previously declared here
  int x1,x2,y2,y2;
            ^
Main.cc:6:34: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'double (*)(double) throw ()' [-Wformat=]
  scanf("%d%d%d%d",&x1,&x2,&y1,&y2);
                                  ^
Main.cc:11:2: error: expected ';' before '}' token
  }
  ^
Main.cc:12:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if(y1>y2){
        ^
Main.cc:13:8: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   z=y1-y2;
        ^
Main.cc:13:7: error: invalid conversion from 'double (*)(double) throw ()' to 'int' [-fpermissive]
   z=y1-y2;
       ^
Main.cc:15:8: error: invalid operands of types 'int' and 'double(double) throw ()' to binary 'operator-'
   z=y2-y1;
        ^
Main.cc:6:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d",&x1,&x2,&y1,&y2);
                                   ^