Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Could negative integers be palindromes? (ie, -1) If ...
分类:
其他好文 时间:
2016-07-31 20:49:29
阅读次数:
189
判断一个数是否回文数,如果1221,232, 3;【输入】:一个整型数iNumber【输出】:0: iNumber不是回文数 1:iNumber是回文数 while(i < length/2 && str.charAt(i) == str.charAt(length-i-1)) 从 头和尾 一对一对 ...
分类:
其他好文 时间:
2016-07-30 16:25:10
阅读次数:
128
Problem Description
Write a program to determine whether a word is a palindrome. A palindrome is a sequence of characters that is identical to the string when the characters are placed in reverse orde...
分类:
其他好文 时间:
2016-06-05 01:11:00
阅读次数:
167
import java.util.Scanner; public class PalindromicNumber { /** * 输入一个五位数判断是否为回文数 */ public static void main(String[] args) { Scanner s=new Scanner(Sys ...
分类:
其他好文 时间:
2016-04-14 22:32:45
阅读次数:
193
题意:输入字符串,判断回文和镜像 分析:打表,比对,标志变量判断 注释:水题,注意细节,注意输出格式!!!!!!!!!!!!!!! ...
分类:
其他好文 时间:
2016-03-29 12:31:07
阅读次数:
99
1 #include "stdafx.h" 2 #include "iostream" 3 4 using namespace std; 5 6 int isechol (const char* str) 7 { 8 int length = strlen(str); 9 for (int i=0;
分类:
其他好文 时间:
2016-02-23 11:10:59
阅读次数:
124
回文数:回文数也是一个数字,数字的特点是正反序是同一个数字,例如:12321,3443,56765....。代码如下:boolJudgeIsPalindromicNumber(intnum){ intarr[20]={0}; inti=0,j=0,count=0; while(num) { arr[i]=num%10; num=num/10; count++; i++; } for(i=0,j=count-1;i<=j;..
分类:
其他好文 时间:
2016-02-17 19:28:44
阅读次数:
151
题目链接:点击打开链接
题意:给你一个n*n的矩阵。 求从(1,1)走到(n,n)所组成的回文串个数。
思路:一开始傻逼把状态写成了d[x][y][s],s表示一个串, 用map存的, 后来发现极不可行, 因为这个状态简直太大了, 包括了s串的所有情况。 只是相当于一个dfs中的剪枝罢了。
后来想到, 其实串是不必记录的, 我们只要统计个数, 所以不妨在DP的过程中就判断回文串的情况, 那...
分类:
其他好文 时间:
2016-02-01 02:20:58
阅读次数:
209
所谓回文字符 串就是指正读反读均相同的字符序列,如“席主席”、“记书记”、“aha”和“ahaha”均是回 文,但“ahah”不是回文。 通过栈这个数据结构我们将很容易判断一个字符串是否为回文。 1 // 4. 判断回文字符串 2 char a[9], s[9]; 3 int i, len, mid
分类:
编程语言 时间:
2016-01-27 17:11:31
阅读次数:
172
1 #include 2 #include 3 int main() 4 { 5 //1.得到这个数字 2.翻转 3.进行比较 4.如果相同 就输出 是 否则 输出不是 6 7 int resource, result, re_tmp; //resource存放用户输入的数值 ...
分类:
编程语言 时间:
2015-12-19 01:27:42
阅读次数:
164