想到 最小公倍数 其余的就好搞了 ,可是没想到#include #include #include #include #include #include #include #include #include #include #include #include #includeusing names...
分类:
数据库 时间:
2014-08-09 23:11:49
阅读次数:
313
三进制搞下, 0 表示没出现过, 第i位为1 表示 i出现了奇数次, 2表示i 出现了偶数次。#include #include #include #include #include #include #include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-08-09 23:07:59
阅读次数:
325
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 because it is the same when t...
分类:
其他好文 时间:
2014-08-09 21:36:09
阅读次数:
344
Palindrome subsequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65535 K (Java/Others)Total Submission(s): 2280Accepted Submission(s):...
分类:
其他好文 时间:
2014-08-09 21:19:59
阅读次数:
274
Problem Description
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move t...
分类:
其他好文 时间:
2014-08-09 18:48:38
阅读次数:
241
Determine whether an integer is a palindrome. Do this without extra space.按照palindrome的定义,负数一定不是palindrome number。而且palindrome number肯定是沿着中轴(可能为一个数或者两...
分类:
其他好文 时间:
2014-08-09 18:37:28
阅读次数:
213
Sumdiv
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 13959
Accepted: 3433
Description
Consider two natural numbers A and B. Let S be the sum of all natur...
分类:
其他好文 时间:
2014-08-09 11:43:07
阅读次数:
226
Description
Ouroboros is a mythical snake from ancient Egypt. It has its tail in its mouth and continously devours itself.
The Ouroboros numbers are binary numbers of 2^n bits that have the prop...
分类:
其他好文 时间:
2014-08-09 11:40:57
阅读次数:
315
今天第一次用了滚动数组,缘由要从一道题说起:POJ 1159 Palindrome 题意:给你一个字符串,求对字符串最少添加几个字符可变为回文串。 分析: 简单做法是直接对它和它的逆序串求最长公共子序列长度len。n-len即为所求。至于为什么,小盆友们可以自己模拟一下下。O(∩_∩)O~因为这不是...
分类:
其他好文 时间:
2014-08-09 11:29:07
阅读次数:
286
看到Palindrome的题目,首先想到的应该是中心问题,然后从中心出发,思考如何解决。
DP问题一般是从更加小的问题转化到更加大的问题,然后是从地往上 bottom up地计算答案的。
能得出状态转移方程就好办了,本题的状态转移方程是:
if (cowID[i] == cow{j]) tbl[id][i] = tbl[id][i+1];//相等的时候无需改动
else tbl[id][i...
分类:
其他好文 时间:
2014-08-09 00:14:16
阅读次数:
344