Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112611 罗子童 螺旋矩阵 C++ Compile Error 0 MS 0 KB 826 2025-03-09 18:55:25

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,x=1,i=0; cin>>n; int a[21][21]; while(x<=n*n){ for(int j=i;j<n-1&&t<=n*n;j++){ a[i][j]=t++; } for(int j=i+1;j<n-i&&t<=n*n;j++){ a[j][n-i-1]=t++; } for(int j=n-i-2;j>=1&&t<=n*n;j--){ a[n-i-1][j]=t++; } for(int j=n-i-2i;j>1&&t<=n*n;j--){ a[j][i]=t++; } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ printf("%4d",a[i][j]); } cout<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:28: error: 't' was not declared in this scope
         for(int j=i;j=1&&t<=n*n;j--){
                               ^
Main.cc:20:23: error: unable to find numeric literal operator 'operator""i'
         for(int j=n-i-2i;j>1&&t<=n*n;j--){
                       ^
Main.cc:20:23: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
Main.cc:20:31: error: 't' was not declared in this scope
         for(int j=n-i-2i;j>1&&t<=n*n;j--){
                               ^