4 like 0 dislike
1.8k views

古書上有記載:『九宮之義,法之靈龜。二四為肩,六八為足,左七右三,載九履一,五居中央。』

其實他是在說一個3X3的魔方陣,就像下面這個一樣。

魔方陣神奇的地方就在於不管是直的、橫的還是對角線,他的和都是一樣。用一個固定的規則把數字填入奇數大小的方陣中,就會產一個魔方陣,其規則如下。

 

照這樣的規則把數字填入5X5的方陣中就會產生以下的魔方陣。

請寫一個程式,輸入一個奇數代表方陣的大小,請依照給予的規則把數字填進去。

 

輸入說明:

會輸入一個正奇數,代表方陣的大小。

 

輸出說明:

請輸出整個魔方陣

輸入範例:

5

 

輸出範例:

17 24 1 8 15

23 5 7 14 16

4 6 13 20 22

10 12 19 21 3

11 18 25 2 9

[Exam] asked in 2017-1 程式設計(一)AD by (18k points)
ID: 36174 - Available when: 2017-12-08 18:30 - Due to: 2017-12-08 21:00
| 1.8k views

5 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
 int i,j,k;
 int x=0,y=0,z=0;
**** **** ** ** * ** *** ** * *
***** ****** **** * * ***
 int arr[j][k];
 j=i;
 k=i;
** *** * * * *
 for(k=0;k<i;k++)



* * ***** * *** ** * ** *** * * *****
** **** * * ** * * *
* ** * * *** * ** ** *** * ** ** *** ** *
* * ** **** * **** * * **** **
* * * * ** ** * *

* ** * ** * ** ** ** *** **** * * ** *
* ** * *** * * ** ** ****
* * * * * ** *** ** * *********** ** * **
*** *** * **** ******* * * *** *
* * * ** *** * **

* ** *** ******** ** * * ** * ******
*** ** * *** *** ** ***** ***** **

* * ** ** * ** * ** * * * ******
** *** * *** * ***** ***** *** * * *** * ***





** ** * * * * *
return 0;

}
answered by (236 points)
0 0
prog.c: In function 'main':
prog.c:18:12: error: expected expression before 'for'
      while(for(j=0;j<i;j++));
            ^~~
prog.c:19:9: error: 'a' undeclared (first use in this function)
      x+=a[j][k];
         ^
prog.c:19:9: note: each undeclared identifier is reported only once for each function it appears in
prog.c:24:12: error: expected expression before 'for'
      while(for(k=0;k<i;k++));
            ^~~
prog.c:38:1: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
 system("pause");
 ^~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>

void c(int num,int i,int j,int n,int *a)
{
    a[i*n+j]=num;
    if(i==0)
*** * ** ***** *** * * * * ** ** ** * *** *
    else
** ********** * ** * * * * * **** ** ** * * ****
    if(j==n-1)
** * ** ***** *** ******** *** * * * *
    else
*** ** **** * * * * * ***** * ** * *
**** ** ** * * * * * ** * ** *
* ** * ** * * * * * ** * *** *** * * * *** ***** **
    else
    {
* * * ** ******** * * **** ****** ** * **** ** *
* * **** * ** *** * **** ** * ** * ** * **** ** * **
** ******* * **** ** * * * *** * *** *** *
* ** * * *** * **** ** * * * * * *********** ** * * *** ****** *
** * * ** * * * * ***** **** * ** *** * * * *
*** * * ** ** * *** ** ** * *** ** ******* * *** * **** * * ******** ***
* * *** ** ** * * ** * * **** * **
*** * ** ** ***** * * * * * ** *** * * * ** *** *** * * **
**** **** ** * * * ** ** * * * * * *** * *
** ******* ** * ** ** * ****** * *** * * * **** * **** *** * *
    }
}

int main()
{
    int n,z,y;
*** ******* ** *** * * ** * * * ** * ** *
    {
****** ** ** ** **** **** ** * ** * *** a[n][n],i,j;
*** ****** ** ***** * **** *** ** * * * * **
* * * ** * ** **** * * **** * * ** ** * * * ** ** * ****** * *** * ** *
* ** * ** ** * **** * *** * *** ** *** * * ** * * **** ****** ** *** * * * * *** * *** *** * * *
** ***** * ** * * ******* *** * ** **** *** * * *
* ******* **** * ** * * ** *** **** ** * * *** ** *
* * ** *** * ****** **** ** * **** * *
** * *** ********* * ****** * ** ** * * *** ***** ** * ** ** *** *
* * ** ** ** ****** * * *** **** *** * ** *** * *** ***** ****** ** ** ",a[z][y]);
**** * ** * * ***** * * ***** *** ******** ** ** ***** * **** ** ** **** **
* ** ** *** * ** *** **** ***** ** *****
    }
    return 0;
}
answered by (30k points)
edited by
0 0
prog.c: In function 'main':
prog.c:56:21: warning: passing argument 5 of 'c' from incompatible pointer type [-Wincompatible-pointer-types]
         c(1,0,n/2,n,a);
                     ^
prog.c:3:6: note: expected 'int *' but argument is of type 'int (*)[(sizetype)(n)]'
 void c(int num,int i,int j,int n,int *a)
      ^
0 0
prog.c: In function 'main':
prog.c:40:21: warning: passing argument 5 of 'c' from incompatible pointer type [-Wincompatible-pointer-types]
         c(1,0,n/2,n,a);
                     ^
prog.c:3:6: note: expected 'int *' but argument is of type 'int (*)[(sizetype)(n)]'
 void c(int num,int i,int j,int n,int *a)
      ^
0 0
prog.c: In function 'c':
prog.c:15:23: warning: passing argument 5 of 'c' makes pointer from integer without a cast [-Wint-conversion]
         c(num+1,i,j,n,a[0]);
                       ^
prog.c:3:6: note: expected 'int *' but argument is of type 'int'
 void c(int num,int i,int j,int n,int *a)
      ^
prog.c:27:25: warning: passing argument 5 of 'c' makes pointer from integer without a cast [-Wint-conversion]
         c(num+1,i+1,j,n,a[0]);
                         ^
prog.c:3:6: note: expected 'int *' but argument is of type 'int'
 void c(int num,int i,int j,int n,int *a)
      ^
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
* ** ** * *
int main ()
{
* *** *** * * ** * ** * a;
* ****** ******** * *** * * * **** *** * *

** * ** **** * * * ** 0;
}
answered by (215 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
prog.c: In function 'main':
prog.c:7:5: error: expected ';' before 'return'
     return 0;
     ^~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<stdlib.h>

void Magic(int n){
* *** * * * * * ** * * * * x[17*17]={0},s=n*n,p=n>>1,q,i;
** * * * ** ** * * ** ***** ***** * *** **** * *
****** ** * * * **** *
** ****** * ** * * * * * * *
** * * * * * * * * ** * ** ** ***** * *** ***** ***
***** *** ** ****** *** *** * *** *
     }
     
     int main(){
*** ** **** ** *** * *** * **** ** * ** * * * * **** ** **** *** * *** ***** * **
******* * *** * ** * ********* * * * *** * * ** *** * **** * * * ********* * ** * * ***** ** *** ** *
** ** ** ** * ** ** ** ** * ** *** ***** * * ** ** * ** *** * * **** *** ** *** *
* *** * **** ***** * ****** * ** ***** *** ** * * * ***** ******* * * * * ** * *** *
* *** * * * * * * ** * ** * * * * ** *** ** * * ***** **** ** **

** ** ***** * * **** ** *** *** ** ** ** ** * *** * ***** ****** *
電機一 410623057林献騰
answered by (150 points)
0 0
prog.c: In function 'Magic':
prog.c:9:40: error: expected ')' before '}' token
      printf("%3d%c",x[i],"\n"[i%n==n-1]};
                                        ^
prog.c:9:40: error: expected ';' before '}' token
prog.c: At top level:
prog.c:10:13: warning: missing terminating " character
      printf("\n);
             ^
prog.c:10:13: error: missing terminating " character
      printf("\n);
             ^~~~~
prog.c:11:6: error: expected declaration specifiers or '...' before '}' token
      }
      ^
prog.c:11:6: error: expected ';', ',' or ')' before '}' token
prog.c:21:1: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
 ^
prog.c:21:2: error: stray '\233' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
  ^
prog.c:21:3: error: stray '\273' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
   ^
prog.c:21:4: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
    ^
prog.c:21:5: error: stray '\251' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
     ^
prog.c:21:6: error: stray '\237' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
      ^
prog.c:21:7: error: stray '\344' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
       ^
prog.c:21:8: error: stray '\270' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
        ^
prog.c:21:9: error: stray '\200' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
         ^
prog.c:21:11: error: expected identifier or '(' before numeric constant
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
           ^~~~~~~~~
prog.c:21:20: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                    ^
prog.c:21:21: error: stray '\236' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                     ^
prog.c:21:22: error: stray '\227' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                      ^
prog.c:21:23: error: stray '\347' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                       ^
prog.c:21:24: error: stray '\214' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                        ^
prog.c:21:25: error: stray '\256' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                         ^
prog.c:21:26: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                          ^
prog.c:21:27: error: stray '\250' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                           ^
prog.c:21:28: error: stray '\260' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                            ^
0 0
prog.c: In function 'Magic':
prog.c:9:40: error: expected ')' before '}' token
      printf("%3d%c",x[i],"\n"[i%n==n-1]};
                                        ^
prog.c:9:40: error: expected ';' before '}' token
prog.c: At top level:
prog.c:10:13: warning: missing terminating " character
      printf("\n);
             ^
prog.c:10:13: error: missing terminating " character
      printf("\n);
             ^~~~~
prog.c:11:6: error: expected declaration specifiers or '...' before '}' token
      }
      ^
prog.c:11:6: error: expected ';', ',' or ')' before '}' token
prog.c:21:1: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
 ^
prog.c:21:2: error: stray '\233' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
  ^
prog.c:21:3: error: stray '\273' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
   ^
prog.c:21:4: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
    ^
prog.c:21:5: error: stray '\251' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
     ^
prog.c:21:6: error: stray '\237' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
      ^
prog.c:21:7: error: stray '\344' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
       ^
prog.c:21:8: error: stray '\270' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
        ^
prog.c:21:9: error: stray '\200' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
         ^
prog.c:21:11: error: expected identifier or '(' before numeric constant
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
           ^~~~~~~~~
prog.c:21:20: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                    ^
prog.c:21:21: error: stray '\236' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                     ^
prog.c:21:22: error: stray '\227' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                      ^
prog.c:21:23: error: stray '\347' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                       ^
prog.c:21:24: error: stray '\214' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                        ^
prog.c:21:25: error: stray '\256' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                         ^
prog.c:21:26: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                          ^
prog.c:21:27: error: stray '\250' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                           ^
prog.c:21:28: error: stray '\260' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                            ^
0 0
prog.c: In function 'Magic':
prog.c:9:40: error: expected ')' before '}' token
      printf("%3d%c",x[i],"\n"[i%n==n-1]};
                                        ^
prog.c:9:40: error: expected ';' before '}' token
prog.c: At top level:
prog.c:10:13: warning: missing terminating " character
      printf("\n);
             ^
prog.c:10:13: error: missing terminating " character
      printf("\n);
             ^~~~~
prog.c:11:6: error: expected declaration specifiers or '...' before '}' token
      }
      ^
prog.c:11:6: error: expected ';', ',' or ')' before '}' token
prog.c:21:1: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
 ^
prog.c:21:2: error: stray '\233' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
  ^
prog.c:21:3: error: stray '\273' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
   ^
prog.c:21:4: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
    ^
prog.c:21:5: error: stray '\251' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
     ^
prog.c:21:6: error: stray '\237' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
      ^
prog.c:21:7: error: stray '\344' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
       ^
prog.c:21:8: error: stray '\270' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
        ^
prog.c:21:9: error: stray '\200' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
         ^
prog.c:21:11: error: expected identifier or '(' before numeric constant
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
           ^~~~~~~~~
prog.c:21:20: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                    ^
prog.c:21:21: error: stray '\236' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                     ^
prog.c:21:22: error: stray '\227' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                      ^
prog.c:21:23: error: stray '\347' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                       ^
prog.c:21:24: error: stray '\214' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                        ^
prog.c:21:25: error: stray '\256' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                         ^
prog.c:21:26: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                          ^
prog.c:21:27: error: stray '\250' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                           ^
prog.c:21:28: error: stray '\260' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                            ^
0 0
prog.c: In function 'Magic':
prog.c:9:40: error: expected ')' before '}' token
      printf("%3d%c",x[i],"\n"[i%n==n-1]};
                                        ^
prog.c:9:40: error: expected ';' before '}' token
prog.c: At top level:
prog.c:10:13: warning: missing terminating " character
      printf("\n);
             ^
prog.c:10:13: error: missing terminating " character
      printf("\n);
             ^~~~~
prog.c:11:6: error: expected declaration specifiers or '...' before '}' token
      }
      ^
prog.c:11:6: error: expected ';', ',' or ')' before '}' token
prog.c:21:1: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
 ^
prog.c:21:2: error: stray '\233' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
  ^
prog.c:21:3: error: stray '\273' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
   ^
prog.c:21:4: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
    ^
prog.c:21:5: error: stray '\251' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
     ^
prog.c:21:6: error: stray '\237' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
      ^
prog.c:21:7: error: stray '\344' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
       ^
prog.c:21:8: error: stray '\270' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
        ^
prog.c:21:9: error: stray '\200' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
         ^
prog.c:21:11: error: expected identifier or '(' before numeric constant
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
           ^~~~~~~~~
prog.c:21:20: error: stray '\346' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                    ^
prog.c:21:21: error: stray '\236' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                     ^
prog.c:21:22: error: stray '\227' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                      ^
prog.c:21:23: error: stray '\347' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                       ^
prog.c:21:24: error: stray '\214' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                        ^
prog.c:21:25: error: stray '\256' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                         ^
prog.c:21:26: error: stray '\351' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                          ^
prog.c:21:27: error: stray '\250' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                           ^
prog.c:21:28: error: stray '\260' in program
 \xe9\x9b\xbb\xe6\xa9\x9f\xe4\xb8\x80 410623057\xe6\x9e\x97\xe7\x8c\xae\xe9\xa8\xb0
                            ^
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<stdlib.h>

int main()
{
* ** * ** ** *** *** * ** map[100][100] = {0};
***** * ****** ** ** ** * * n, j, k, l;
* *** * ******* *** * *** * ** ****** * ** * *** &n);
    k = n / 2;
    j = 0;
    l = 1;
** * ****** * * ***** * * = l;
    l ++;
** * *** ** * ** <= n * n)
    {
* * ** * * *** * **** * * * *** **** * ** * --;
*** * ** * ** **** ** ** ** *** * < 0)
** ** ** *** ** ************* *** * * * ** *** * ** * * * * ***** = n - 1;
* ** * ** ** *** ** ** * ** * *** * ** * * * ++;
* **** ** * * ** * ******* ****** * ** * * * >= n)
** ** ******* *** * * ** * * * * *** * * ***** * * * * = 0;
***** * ** *** * * * *** ** ****** ** **** * != 0)
* * * * ** ** ** * ******** * * ***
* ** ** * **** **** *** * * ** * * * * ** ****** * ** * ++;
* **** **** ** ** ** * * ** *** ** ********* * * ** >= n)
** * ******* * ** * ******* **** * * *** * * ** ** * ** * * * * * * * = 0;
* * **** * ** * * * * * **** ** ** **** ** * **** * * * * * ** ++;
* ** *** ****** ** * * * *** * *** * *** * ** * *** * * *** *** ** * >= n)
* *** * * ** * * * * ******* * ** * ***** ** * * *** **** **** * ** * ** ** = 0;
* *** ** * ** * * ** * ******** * * ** ** ***** * * --;
** *** * ***** *** *** ** ** ** ** * * ** ** *** * * * * * *** < 0)
* *** *** ** * ** * ** * * ** * ** *** *** * ********** * ** * ** ** ** = n - 1;
* ** ** * * * ** ** *** * * *** * * **
* *** * ******* * *** ** * * * * * ** * * ** **** **** = l;
** *** * ** ** ***** **** ** * ++;
**** * * ** ***** ** *
** * * * *** * * * * * = 0;j < n;j ++)
    {
* * **** * ** * * ** * * * * * ***** * * * ** * = 0;k < n;k ++)
*** * ** *** * *** ****** **** * * **** * ** ** *** * ** * ** ****** * * *** ***** ",map[j][k]);
** * * ******** ********* ** * * *** * ** * * * != n - 1)
* * * **** ***** ** *** ** *** **** * *** * ** * * ** * * **** *
    }
}
answered by (18k points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Wrong output
0 0
Case 0: Correct output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.149
©2016-2025

Related questions

2 like 0 dislike
6 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38150 - Available when: Unlimited - Due to: Unlimited
| 2.1k views
2 like 0 dislike
5 answers
[Normal] Essay (Open question) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38147 - Available when: Unlimited - Due to: Unlimited
| 657 views
2 like 0 dislike
5 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38942 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 1.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users