QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#277145#7042. So Easyzzuqy#Compile Error//C++11713b2023-12-06 15:41:482023-12-06 15:41:48

Judging History

你现在查看的是最新测评结果

  • [2023-12-06 15:41:48]
  • 评测
  • [2023-12-06 15:41:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int read()
{
	int x;scanf("%d",&x);return x;
}
int n,a[1010][1010],x0,y0;
int main()
{
	// freopen("1.in","r",stdin);
	n=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			a[i][j]=read();
			if(a[i][j]==-1){
				x0=i,y0=j;
				a[i][j]=0;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		 if(i==y0)
		 	continue;
		 if(a[x0][i])
		 {
		 	int x=a[x0][i];
		 	for(int j=1;j<=n;j++)
		 	{
		 		a[j][i]-=x;
		 	}
		 }
	}
	int ty=1;
	if(y0==1)
		ty=2;
	for(int i=1;i<=n;i++)
	{
		if(a[i][ty])
		{
			int x=a[i][ty];
			for(int j=1;j<=n;j++)
				a[i][j]-=x;
		}
	}
	if(x0==1)
		cout<<a[2][y0];
	else
		cout<<a[1][y0];
}

Details

answer.code:7:24: error: ‘int y0’ redeclared as different kind of entity
    7 | int n,a[1010][1010],x0,y0;
      |                        ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’
  220 | __MATHCALL (y0,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:18:40: error: assignment of function ‘double y0(double)’
   18 |                                 x0=i,y0=j;
      |                                      ~~^~
answer.code:25:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |                  if(i==y0)
      |                     ~^~~~
answer.code:37:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |         if(y0==1)
      |            ~~^~~
answer.code:49:27: error: invalid types ‘int [1010][double(double) throw () {aka double(double)}]’ for array subscript
   49 |                 cout<<a[2][y0];
      |                           ^
answer.code:51:27: error: invalid types ‘int [1010][double(double) throw () {aka double(double)}]’ for array subscript
   51 |                 cout<<a[1][y0];
      |                           ^
answer.code: In function ‘int read()’:
answer.code:5:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         int x;scanf("%d",&x);return x;
      |               ~~~~~^~~~~~~~~