Toggle navigation
Courses
Questions
Tags
Users
AC 20170105 期末 第三題
0
like
0
dislike
3.1k
views
請設計一個程式,使用者會輸入一個字串,請判斷該字串是否為回文(palindrome)。
輸入範例1:
12321
輸出範例1:
12321 is a palindrome
輸入範例2:
apple
輸出範例2:
apple is not a palindrome
[Exercise]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20980 -
Available when:
Unlimited
-
Due to:
Unlimited
reshown
Jan 5, 2017
by
Shun-Po
|
3.1k
views
comment
Please
log in
or
register
to add a comment.
43
Answers
0
like
0
dislike
Hidden content!
* * ** **** ** *
* ** * * *** * *
* * *
* ***** * **
* ** * * * *** ***
* ** ( void )
{
** *
** * * **** ***** * *
**** * != ** * * *** *** is not a * ** * ***
* *
if * != * ***** *** * ** is not a ** * *****
* *
** *** * ** is a * **** *
* 0;
}
answered
Jan 5, 2017
by
410523022
(
-276
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int is_palindrome(char *s)
{
* ***** ***** **** * ** i, len;
* ** **** * ********* = strlen(s);
**** * * ** * ** * ***** * = 0; i < (len /2); i++)
* *** *** **** * **
* * * * ***** ** ******** *** * * * *** * * * * != s[len-i-1])
** * * * * * ** * *** ** *** * *** * ** ** *** ** * * * * ** * * 0;
* * *** ** * *
**** ** * * ** ***** ** (i >= len/2)
** ***** * ** * * * *** * ** *** * * * *** * * 1;
* *** * *** * * ** ** *
** ** * * * * * ** * ** *** * ** 0;
}
int main()
{
** * ** **** *** * ** **** s[256];
* ** ** * *** **** ** ** ** * * *
* * * * *** *** ***** *
* * * * *** *** ***** * ** * * ** *** * **** * * * **
* * *** * ******* * ** **** **** * * ****** * * *
** * * * **** * * ** * * *** * * **** **** * * * * * * * * *** *** *** is palindrome\n", s);
*** * * * * *** *** ** ** * * * * *** ** *
** * * *** **** * ** * * ** * * * * * **** * * * * **** *** ** is not palindrome\n", s);
** * **** ** * * * * *
}
answered
Jan 5, 2017
by
410523018
(
164
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
int c;
int spring(c); * * *** *** *** ** ****** ** ** *** * * ** * * *** * ** ** * * * *** *** * * * * *** * * * * ** * *** * ** * ** * ****** *** * **** * **** *** **** ** * ** * ** * * *
scanf("%c",spring(c)); * * ** * * * * * ** * * * ** ** * *** * ** * * ** *** * ** * *** * * * *** * * **** * * *** *** *** *** * * * ** * * ********* *
*** ** * * * *** * **** * ** * * ***** * * * ** * * ** ***** ***** * ** * ** * * *********** * * * **** * ** * *** ** * * *** ** **** * ******* ** **** * ** * * ****** ** ** ** * * * * ** * * * *** * * * * ** * * * ** * *** ** ********* ** ** * ** * * ** * ***** ** ** ***** * **** * *
*** * ** * * * * * **** ** *** **** * * ******** ** **** * * * * * **** * * *** **** * * * * * * ** ** ** * * * * * *** ***** ***** ** * * *** *** ** * * * * * ** * ** ** *** * * * ** *** ** * ** ** * * * ** ** * * * * ******** * * ** *** **** * **** * *** ****** ** *
if(spring(c) is a palindrom ) * *** ** ** * * ** ** ** * ** ** ** * *** ** ** * ** **** *** ** *** ******* ** *** * *** ** *** ** ** * *** * * ** ** * * ***** *** *** ** * * * * * * * ***** ** ** ** **** ** *** * ***** * * * * *** * * ** * ** ***** ***** **
{ * * * * * ** *** ******* *** *** ******** ** *** * ** * ***** ** * * * *** * * * * *** ** * ** * ***** *** ** *** *** * *** * *** *** * **** * *** ******* ** * ** * ** **** * * *** **** ** * * * * *** * * * * ******* *** *** * ** * *** * **** * *** **
printf("%c is a palindrome",spring(c))
} ** ** * * * * ** * * ** ** ** * * ** ** ***** ** ** * * ** * * * ***** * ** ** * ** ** *** ** * * * *** *** * * *** * * *** ** ** ** **** ** **** *** * *** *** ******* * ** ** *** **** * * * * *** * ******* * * * * **** * ** ** ** ** *** **** ** *** * * * * * * *** * ** * ** ***** *** *
else * *** ** * * ** * ** **** * ** * ***** *** * **** *** * * * **** **** *** * *** * * * ** ********* * *** ********* ***** **** * * *** **** ** * ** ** ** *** ** ******* *** ** **** * * ****** ***** * *** ** * * ** ** *** *** * * *** *** * ** ** *** ****** *
{ * * * * * ** **** * * * * * ** * * **** * *** * ** ** *** * * * * * ** ** * * * * ** * * ** **** * ** * * *** * * *** ** ** ****** ** ** * * * ** * * *** * * * * ** * * * ** ** * **** ***** ** *** ** **** ** * * * * ********* *** * ** ** * **** * *****
printf("%c is not a p alindrome",spring(c))
} ***** *** ** * * * ** * ** * * ** * ** *** * ** * * ******** * * * ***** ** * *** **** * *** * * * *** * ****** ** * * * * **** * * ***** * ** ** * ** * ** *** * * * * * * *** * * * ** ** ** ** ** ** * * ******* ** ** **** ** ** **** ** * * ******* * *********** ** * * * *** * * ********** ***** *
return 0;
}
answered
Jan 5, 2017
by
410523049
(
-24
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
* ** * ** **
* * * ** **
int is_palindrome(char *s)
{
** *** ** * *** a, k;
****** * * * = strlen(s);
* * * * *** * * ** * = 0;a <(k /2);a++)
*** ** *
* * ****** * ** * * * * * * * * **** (s[a] != s[k-a-1])
** * * ** * * * * * * * *** * *** * * * * 0;
* * ****** ***
* ** * *** * ****** *** * >= k/2)
** ** ** ** ***** * * * *** * * * 1;
** ** * * * ** *
***** * ***** ** * ** ***** ** * *** 0;
}
int main(void)
{
** * * *** * *** * s[256];
*** ** * * ** ******
* * *** ** * * *****
** *** * **** * * ** *** * *
* ** *** *** ******* * * *** *
* ** * * **** * * * * ** * * *** *** **** * **** * * * *** is a palindrome\n", s);
* * * * * * * * ****** ***** ** *
* *** * * * * ****** * * * ** **** *** * ****** * * * is not a palindrome\n", s);
* * ** **
}
answered
Jan 5, 2017
by
松山金城武
(
102
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include ** ***
int is_palindrome(char *s)
{
* * * * * i, len;
* * *** *** ** ** = strlen(s);
* **** * *** ***** ** ** = 0; i < (len /2); i++)
*** * ** * ****
* * **** * **** ** * **** ***** * * (s[i] != s[len-i-1])
* * ** ****** * ***** * * ** ** * * ** * 0;
**** ** * *** * **
*** **** * **** ** (i >= len/2)
** **** *** * * * **** ** 1;
***** * ** ****
* * ** **** ** **** * * *** ** ***** ** 0;
}
int main()
{
******* ** * * * s[256];
*** ***** * * *** *
* * * ** * * *
** * * *** * * ** *** **** ** * * ***
* ***** ***** *** ** *** * * * (is_palindrome(s))
* ** * ***** * * * ** * ** * * ** * * ** *** ** ** * ** * is a * * * s);
* * * **** * **** **** * * *** * * * *
** ** *** * *** * * * *** * **** * ** * * * *** * * is not a ***** ** * * s);
* ** * ** * **
}
answered
Jan 5, 2017
by
410523018
(
164
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
* *
answered
Jan 5, 2017
by
410523022
(
-276
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include ** ******** ** *
#include * **** *
int is_palindrome(char *s)
{
* ** ** * * * i, len;
*** * ** * * * = strlen(s);
** ** * *** * * * ** = 0; i < (len /2); i++)
* ** ****
* * * ** ****** * ** ** *** (s[i] != s[len-i-1])
* * * * * * * ** * * ** * * * * * ***** ** ** * 0;
* * ** *** **
* * ** ** * (i >= len/2)
** * * ** * *** * * ****** 1;
* **** * * * * * *
**** *** * * * ** ** * ** * 0;
}
int main()
{
* *** *** ** ***** ** * * s[256];
*** ** * *** ** ****
* * *** **
** * ** * **** * ** ** * * * *
***** * * *** ** * * ***** ** ** (is_palindrome(s))
**** * * * *** *** * ** * * * ** * * * * * * * ** is a palindrome", s);
* ***** * * ** ** * *** *
** * **** *** * * * ** *** * **** ** ** ** * * ***** ***** is not a *** ** *** s);
* * ** * ***** ***
}
answered
Jan 5, 2017
by
410523017
(
152
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * * * ** ** * *
#include * *** ** *
int main(void)
{
* * * *** ** ** s[1000000];
* * ** * * *** * * **** i, j, n;
****** *** ** * **** ****
**** ** * ** * * ** *** *
* * ** ** * ** ** ** ** **** * ** *
* * * * * ** * * * ** * * ** ** break;
** ** ***** *** **** ** * * * *** ** **
* * * ** ** ** *** ***** *** * * **** **** ** * * * * ********* is a palindrome", s);
** ** ** *** * *** **** * ** *
***** * * * * * ** ** * * ** * * * * *** * ** * is not a palindrome", s);
* ****** * * * ** * * 0;
}
answered
Jan 5, 2017
by
s31102
(
-100
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include * ** *** ******
int is_palindrome(char *s)
{
* ** ** * ** * * * * i, len;
* ** ** * * = strlen(s);
* ** ** * ** * * ***** = 0; i < (len /2); i++)
* ** ** * ****
* * * ** ** * * * ** * **** ** * (s[i] != s[len-i-1])
*** * ** ** * **** * * * * * *** ****** ******** * * * ** 0;
** * ** ***** * * *
* *** ** ** *** (i >= len/2)
* ** ** **** ** ** * * ** *** ** ** * 1;
** * * ** * * ** * *
* * * *** ** *** ****** * *** ** 0;
}
int main()
{
*** ** * *** ** * s[256];
* ** **** * ***** * ***
** ** ****
* * * * * *** *** ** ** *** * ** * *** *** **
** *** * ** *** ****** ** * * * * (is_palindrome(s))
**** ** * ** * * * ****** * **** * ** ** ** *** * * * ** ** is a * ** * * ** s);
****** * * ** *** ******** ** ** *
* ** *** * * * * * *** ** **** ** ** * ** *** * is not a * * ** * ** s);
**** * * * * * *
}
answered
Jan 5, 2017
by
410523017
(
152
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include * ***** * ***
int is_palindrome(char *s)
{
** * ***** ** *** i, len;
** ** * * **** * *** = strlen(s);
* * ** ** * ** * ** = 0; i < (len /2); i++)
** **** *** * **
* ** * ** * * ** * * *** ** * * *** * (s[i] != s[len-i-1])
* * **** * * ** ** ** *** * **** * * * * *** * * * * 0;
***** **** **
* * ** * * ** ** * (i >= len/2)
* ** ** ** * **** *** * * ** * * * *** * 1;
** ***** *** ** * ****
** ** **** * **** * ********* 0;
}
int main()
{
** **** *** ** s[256];
* ** * * * ***
** ***** *** ***
** * * ** *** **** * * ** **** *
* ** * * * * *** ** *** * (is_palindrome(s))
** * * * * *** *** * ** ****** * * * ** *** ** *** *** * * * * is a *** * ** ** s);
* * ****** ** ** *** * *** **
** * ** *** ** ** ** * ** **** ** ** ** ** *** ** *** * * * is not a *** ** * s);
* ***** * * ****
}
answered
Jan 5, 2017
by
410523017
(
152
points)
ask related question
comment
Please
log in
or
register
to add a comment.
Page:
« prev
1
2
3
4
5
next »
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English
中文
Tiếng Việt
IP:172.70.131.117
©2016-2025
Related questions
0
like
0
dislike
3
answers
AC 20170105 期末 第六題
[Exercise]
Essay (Open question)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20995 -
Available when:
Unlimited
-
Due to:
Unlimited
|
610
views
0
like
0
dislike
144
answers
AC 20170105 期末 第五題
[Exercise]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20993 -
Available when:
Unlimited
-
Due to:
Unlimited
|
8.9k
views
0
like
0
dislike
28
answers
AC 20170105 期末 第四題
[Exercise]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20984 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2.2k
views
0
like
0
dislike
39
answers
AC 20170105 期末 第二題
[Exercise]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20978 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2.8k
views
0
like
0
dislike
16
answers
AC 20170105 期末 第一題
[Exercise]
Essay (Open question)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20974 -
Available when:
Unlimited
-
Due to:
Unlimited
|
1.6k
views
12,783
questions
183,442
answers
172,219
comments
4,824
users