题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然后就得到是长度为多少的第几个的回文串了,有个细节注意的是, n计算完后要-1! 下面给出AC代码: ...
分类:
其他好文 时间:
2017-07-04 11:12:00
阅读次数:
131
12050 - Palindrome Numbers Time limit: 3.000 seconds A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, ...
分类:
其他好文 时间:
2017-07-03 22:25:31
阅读次数:
170
翻译 给定一个单链表,确定它是否是回文的。 跟进: 你能够在O(n)时间和O(1)空间下完毕它吗? 原文 Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) t ...
分类:
其他好文 时间:
2017-07-03 21:07:59
阅读次数:
126
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the name “anna” is a palindrome. Numbers can also be ...
分类:
其他好文 时间:
2017-07-03 20:00:11
阅读次数:
153
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, the name “anna” is a palindrome. Numbers can also be ...
分类:
其他好文 时间:
2017-07-03 19:14:00
阅读次数:
123
“回文”是指正读反读都能读通的句子。它是古今中外都有的一种修辞方式和文字游戏,如“我为人人,人人为我”等。在数学中也有这样一类数字有这种特征,成为回文数(palindrome number)。 设n是一随意自然数。若将n的各位数字反向排列所得自然数n1与n相等,则称n为一回文数。比如,若n=1234 ...
分类:
编程语言 时间:
2017-07-02 21:16:54
阅读次数:
302
Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, ...
分类:
编程语言 时间:
2017-07-01 12:40:30
阅读次数:
191
題目:給你一個字符串,在後面拼接一部分使得它變成回文串,使得串最短。輸出這個回文串。 分析:KMP,dp。這裡利用KMP算法將串和它的轉置匹配,看結束時匹配的長度就可以。 因為串比较長。使用KMP比较合適,KMP原理請参照AC自動機總結。 說明:╮(╯▽╰)╭。 #include <string.h ...
分类:
其他好文 时间:
2017-06-28 23:18:14
阅读次数:
192
import java.util.Scanner; /** * 给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的 * @author kif * */ public class Palindrome { public static void judge(String str... ...
分类:
其他好文 时间:
2017-06-24 22:50:00
阅读次数:
208