P75,练习101994年柯利弗德·皮寇弗在Usenet社群sci.math的文章中首度提出吸血鬼数。后来皮寇弗将吸血鬼数写入他的书Keys to Infinity的第30章。吸血鬼数字是指位数为偶数的数字,可以由一对数字相乘而得到,而这对数字各包含乘积的一半位数的数字,其中从最初的数字中选取的数字...
分类:
其他好文 时间:
2014-07-14 15:00:55
阅读次数:
217
代码:
#include
#include
#include
#include
int main()
{
int num[100];
int odd = 0, even = 0;
std::string str;
getline(std::cin, str);
std::stringstream s(str);
int j = 0;
while(getline(s, s...
分类:
其他好文 时间:
2014-07-13 13:54:31
阅读次数:
280
eq相等 ne、neq不相等, gt大于, lt小于 gte、ge大于等于 lte、le 小于等于 not非 mod求模 is [not] div by是否能被某数整除 is [not] even是否为偶数 is [not] even by $b即($a / $b) % 2 == 0 is [not...
分类:
其他好文 时间:
2014-07-11 11:41:22
阅读次数:
208
题意:求最大的三角形
思路:先初始化从左到右和从右到左的最大连续的‘-’,然后就是当奇数列的时候找头向下的三角形,偶数的时候相反找
#include
#include
#include
#include
using namespace std;
const int MAXN = 200;
char map[MAXN][MAXN];
int Left[MAXN][MAXN], Rig...
分类:
其他好文 时间:
2014-07-10 22:09:52
阅读次数:
272
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u...
jQueryt过滤选择器基本过滤选择器选择器描述返回示例重要:first返回第一个元素单个元素:last返回最后一个元素单个元素:not(selector)除去与给定选择器匹配的元素集合元素☆:even偶数元素集合元素:odd奇数元素集合元素:eq(index)返回集合中指定索引的元素,索引0开始单...
分类:
Web程序 时间:
2014-07-08 21:53:29
阅读次数:
364
旋转可以分为n种置换,对应的不同等价类分别是gcd(n,i)个i=0时不动,有n个
翻转分为奇偶讨论,奇数时有n种置换,每种有n/2+1个
偶数时有n种置换,一半是n/2+1个,一半是n/2个
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;...
分类:
其他好文 时间:
2014-07-08 19:05:15
阅读次数:
163
如果一个字符串从左向右写和从右向左写是一样的,这样的字符串就叫做palindromic string,如aba,或者abba。本题是这样的,给定输入一个字符串,要求输出一个子串,使得子串是最长的padromic string。
下边演示3种思路
1.两侧比较法
以abba这样一个字符串为例来看,abba中,一共有偶数个字,第1位=倒数第1位,第2位=倒数第2位......第N位=倒数第...
分类:
编程语言 时间:
2014-07-08 17:49:03
阅读次数:
238
??
当年徐迟的一篇报告文学,中国人知道了陈景润和歌德巴赫猜想。
那么,什么是歌德巴赫猜想呢?
哥德巴赫是德国一位中学教师,也是一位著名的数学家,生于1690年,1725年当选为俄国彼得堡科学院院士。1742年,哥德巴赫在教学中发现,每个不小于6的偶数都是两个素数(只能被和它本身整除的数)之和。如6=3+3,12=5+7等等。公元1742年6月7日哥德巴赫写信给当时的大数学家...
分类:
其他好文 时间:
2014-07-08 13:57:26
阅读次数:
231
def isOdd(n):
return n & 1
def Reorder(data, cf = isOdd):
odd = 0
even = len( data ) - 1
while True:
while not isOdd( data[ even ]) : even -= 1
while isOdd( data[ odd ]) : odd += 1
if odd ...
分类:
其他好文 时间:
2014-07-08 12:47:26
阅读次数:
276