判断输入字符串是否为镜像或回文串。 来源于UVaOJ - 401. 水题。
判断输入字符串是否为镜像或回文串。 来源于UVaOJ - 401. 水题。
题目 代码题目https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342 水题 代码#include #include #include //#include #include<algori
Description ... Palindromes A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome
water problem. #include #include #include #include using namespace std; #define MAX_CHAR 21 char con_digit[] = { '1', 'S', 'E', '-', 'Z', '-', '-', '8', '-' }; char con_c
解题思路:理解题意,主要是对回文与镜像回文的判断。两者可以同时进行。 对回文来说,首尾字符要相同;对镜像回文来说,第一个字符需要是最后一个字符的镜像,第二个字符需要是倒数第二个字符的镜像,……。...
【代码】401 - Palindromes。
#include #include char table[2][21]= { 'A','E','H','I','J','L','M','O','S','T','U','V','W','X','Y','Z','1','2','3','5','8', 'A','3','H','I','L','J','M','O','2','T','U','V','W','X','Y','5','1','S','E',
题目:4种情况, 判断是否为回文, 是否为镜面对称。 #include #include int p(char str[]) //是否为回文 { int i; for(i=0; i(str)/2; i++) { if(str[i]!=str[strlen(str)-i-1]) ...
这一题的话我们可以把映像字符的内容给放入一个字符串常量里面,然后开辟一个二维的字符串常量数组,里面放置答案。 对于回文实际上是很好求的,对于镜像的话,我们写一个返回char的函数,让它接收一个char。...
PalindromesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1253Accepted Submission(s): 504Problem DescriptionA regular...
本题展现了JAVA字符处理的强大能力import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while (cin.hasNextLine()) { ...
题意 输入一个字符串,判断它是否为回文串以及镜像串。输入字符串保证不含数字0。所谓回文串,就是反转以后和原串相同,如abba和madam。所有镜像串,就是左右镜像之后和原串相同,如2S和3AIAE。...
字符串的简单模拟,需要注意的是输入里面保证不会有零 #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define mk make_pair #define sz(x) ((int) (x).size()) ...
题目地址 : ... 好久没有刷题了 感觉题目比较简单 锻炼思维的严谨性 看来刷题还是很
AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 1. Elementary Problem Solving::String ...// 401 - Palindromes #include <iostream> #include <cstring> using namespace ...
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string"ABCDEDCBA"is a palindrome because it is the same when the string is read...
UVA 题目401 - Palindromes
题目大意: 多组输入,输入一个字符串,判断是不是回文串和镜像串,输出要求: 如果该串既不是回文串也不是镜像串 则输出 is not a palindrome. 如果该串是回文但不是镜像串 则输出 is a regular palindrome. ...
写了半天,提交到UVa 提示运行超时,不是这是一个好的开始 package 第三章;...public class Palindromes { private static char[] cs; private static char[] cs2; public static char dy(char v)