1 like 0 dislike
14.6k views

(20%)由於經濟不景氣,張三決定改行當個占卜師。但張三對於占卜術還不太上手,非常苦惱。請幫他設計一個程式如下:

請輸入一個日期,然後依照下面的公式:

M=月
D=日
S=(M*2+D)%3

得到 S 的值,再依照 S 的值從 0 到 2 分別給與 小吉(small)、中吉(medium)、大吉(big) 等三種不同的運勢。

input:

1 1

output:

small

 

[Exam] asked in 2017-1 程式設計(一)AD by (30k points)
ID: 43449 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30

edited by | 14.6k views

21 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
   int M,D,S;
** * * * * * *** * ***** ** ** * * *** **
*** * * ** **** * * *
* * * ** * *
* *********** * * * * ** * * **
* * * * *** **** ** *
*** **** * ** * ** * * ** * *** *** * * ***
* * ** ** * ** * * * *
** ** ** *** * ** * * * *** **

* *** *** ******* * 0;

}
answered by (162 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int m, d, s;
* ** * * *** * *** * * * * *** ** * * ****** * *
* ** *** ** ** * ** * ** *
** ** * *** * ** * * *
* ** * **** * ** * * *** * ** ** * * *** * * ******** **
** * **** ** * **** * * * if(s==1)
* * * ** * * * * ** *** ** ** ***** ********** *
* * * * *** * * ** * if(s==2)
*** * * * ** ** * ** *** ** * * * * * * ** ** * * *
* ** * ***** *** * ** * 0;
}
answered by (144 points)
edited by
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xb0\x8f\xe5\x90\x89",s);
               ^~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe4\xb8\xad\xe5\x90\x89",s);
               ^~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xa4\xa7\xe5\x90\x89",s);
               ^~~~~~~~
prog.c:13:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xb0\x8f\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe4\xb8\xad\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xa4\xa7\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:13:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xb0\x8f\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe4\xb8\xad\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xa4\xa7\xe5\x90\x89\n",s);
               ^~~~~~~~~~
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xb0\x8f\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe4\xb8\xad\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xa4\xa7\xe5\x90\x89\n",s);
               ^~~~~~~~~~
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xb0\x8f\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe4\xb8\xad\xe5\x90\x89\n",s);
               ^~~~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("\xe5\xa4\xa7\xe5\x90\x89\n",s);
               ^~~~~~~~~~
0 0
prog.c: In function 'main':
prog.c:8:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("small\n",s);
               ^~~~~~~~~
prog.c:10:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("medium\n",s);
               ^~~~~~~~~~
prog.c:12:15: warning: too many arguments for format [-Wformat-extra-args]
        printf("big\n",s);
               ^~~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* *** * ** * ** * * ***** M,D,S;
    
* * * ** ** * *** ** ** * %d",&M,&D);
    
*** * ** ** * **** ** *
** * * ** *** *** **
* ** * ** ** ***
* * * * **
* * ****** ************* ** ** ** *** * ** * ** ** * * *** **
** * ***** * ** * * * *
*** ** ** * * * * ** if(S==1)
**** * * * * *** *
* **** * * ** ** ** * ** * ** ** ** * * * ** * * * ** ** * * * * ** * * *
*** ** ** *******
**** *** *** * * if(S==2)
* * **** * *** * * *
* * *** *** **** ** ** * *** ** * ** * ** * * * * **** *
** *** ** *** * * *
** * **** ** **** 0;
}
answered by (215 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<stdlib.h>
int main()
{
** ** * * m,d,s;
* * * ****** ** *
** * * ** * * *** **** %d",&m,&d);
    
* ** * ** * * **** + d)%3;
* ** ** ** * * *
*** * ** ** * **
** * ** * *******
* ***** ** ** ***** * ***** **** * ** ** ********* * * *
* ** ***** * ** ***
**** ** * *** * ** ****** * if(s==1)
** * **** * ** **** **
* * * * *** * ** * ** * ****** * **** * ** ***** ** ** * **** **
** * *** * ** *** **
** ** ** * *** ** ** if(s==2)
* * * ** *** ** * **
* ** ** * * * *** ** ***** * **** ***** *** * ** ** * *** * *** **
* * ** * ** * * ** * * *
** ****** * * *
return 0;
}
answered by (185 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
* *** ** * *****
int main()
{
int M,D,S;
** * ** ** * ***** *** * *****
scanf("%d * *** * ** *** **** *
S=(M*2+D)%3;
if(S==0)
* * **** * * * ** *** **** * *
******* * ** *** ** *** if(S==1)
**** **** * ** * * **** * **** * *** * ** * * * * ***
* ** ** * *** * **** * *** * ** * * *
*** **** * * ** * ** ** * *** * ** ** ** * ** *** ** ** ** *** * * * * ** ** * *****



return 0;
}
answered by (236 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main ()
{
* **** *** *** * **** m,d,s;
* **** ** * * * * * * ** * * ** * ** * ** *** *
******* ** *** *** * **** = (m*2+d)%3;
** ** * ** *** * * (s == 0)
**** * * *** * * * *** * **** *
** **** ** * ** * * * * * * ** if (s == 1)
* * * *** * * * * * *** * * * ** **
** ** * ** ** * if (s == 2)
**** * * ** *** * * * * ** *** * * ** ***
* **** ** ** *
** ** * ** * * ** * * * *** 0;
}
answered by (190 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
*** ** * * * * * *** M,D,S;
* * *** * *** * ** * *** * * * * %d",&M,&D);
*** ******** *** ** * *** **
* * * * * * *** * * **
* ** *** *** **** ** * * *** * * **** *
** * * * *** ** ** * **
** * * ** *** * *** *** * *** ** *****
**** ***** **** *** **
***** *** * *** ****** * *** ** * * ** *
* **** * * ** ** ***** 0;
}
answered by (228 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main ()
{
** *** ********* *** * ** ** * m,d,s;
* **** ***** ** ** ** ** * * * * * * ** * * ** * *
* *** * *** * * * * * = (m*2+d)%3;
** * **** * * ** ** (s == 0)
* *** * * **** * ** ***** * * ** * ** ** **
***** *** * * ** ** if (s == 1)
** **** ** ** ** * * * * * * * * ** ** *
** ** ** * * * * * if (s == 2)
** ****** ****** * * ***** * * * * ** * *
** ** * * ** ** * ******
* *** * ** * *** * 0;
}
answered by (209 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int m,d,s;
****** *** * *** ** * ** %d",&m,&d)!=EOF)
    {
* * **** *** * ** * * ** * *** * **** **
*** * ** * * **** ** * ****** *** * *** ** * **
* * ** * ******** *** * * * ***** * ** ** * * * * * * * * * * * ** ** * *** * * *
*** * * * ** *** ** *** * ** ** * if(s==1)
**** ********* * *** *** ** ** **** ** ** * *** ** * ** * * ** * * * * ** *** *
* * * * * * ** **** * **** ** * ** *** ** if(s==2)
* ***** ** *** * * * *** *** *** ** * *** ** * ***** * **** ** * *** *** * * *
**** ** * * * ** * ** ** **** **** ** *
** * * * *** * * ** * *** ** * * *** * * ** * * * ** * **** **** * * * ** ***
    }
* * ******* ** *** * * 0;
}
answered by (100 points)
edited by
0 0
prog.c: In function 'main':
prog.c:5:19: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
     while(scanf("%d %d",m,d)!=EOF)
                   ^
prog.c:5:22: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'int' [-Wformat=]
     while(scanf("%d %d",m,d)!=EOF)
                      ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
* **** * *

int main()
{
int M,D,S;

* ***** * * * ** ** * ***
* ** *
**
{
* * ** ** *** *
}
* ***
{
* ** * ** *
}
*
{
**** ** **** *
}
** ** * ** * *

}
answered by (174 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.105
©2016-2025

Related questions

1 like 0 dislike
24 answers
[Exam] asked Jan 19, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 43456 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30
| 4.2k views
1 like 0 dislike
24 answers
[Exam] asked Jan 19, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 43455 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30
| 3.7k views
1 like 0 dislike
24 answers
[Exam] asked Jan 19, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 43454 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30
| 5.2k views
2 like 0 dislike
24 answers
[Exam] asked Jan 19, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 43453 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30
| 3.9k views
1 like 0 dislike
23 answers
[Exam] asked Jan 19, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 43452 - Available when: 2018-01-19 18:30 - Due to: 2018-01-19 21:30
| 3.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users