Problem 36 Double-base palindromes

Problem 36: Double-base palindromes

https://projecteuler.net/problem=36

The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.

Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.

(Please note that the palindromic number, in either b[……]

>> 阅读全文…

华为实习生面试归来

实验室被分成了几波人,有早上很早去的,有11点去的,还好我是下午3点的面试。早上还可以再临阵磨枪一下。

接受上次实验室去阿里面试回来的优秀芳的经验,特意按照简历上的内容做了最后的巩固,试图将简历上上提到的再温故一遍,因为好多已是很久之前的经历了。比如本科的那些项目和比赛的事情,过去好几年了已经。

技术方面,我在简历上侧重就写了数据库、C\C++,STL,MFC,Python,网络编程等几项,因为这是我这次面试的重点,其它的接触过的语言或技术都作为兴趣,并没有体现在简历上。

由于2:30会有车在地铁出口等待,我和优秀芳在1点还没到就出发,踏上开往西兴的地铁。到达时,刚刚2点。等[……]

>> 阅读全文…

阿里实习生笔试归来

笔试安排在浙大的玉泉校区,时间是昨天晚上6:30~8:30,周六晚上,这个时间点不得不说给很多人带来了不便,不知道是出于什么考虑。很早就投了简历,安排是29号全国统一笔试,等到笔试前两天才收到短信,开始还惶惶的以为要刷人。

有几个同学分在了不同的教学楼,看来这次的规模真的很大。我所在的考场不大,共52个人,我就是51号,不过这个数字我还挺满意的,因为每个位置上放的编号卡片上有写这是51job组织的,51job,51号,不错,很有意义。

回到正题吧,考场中有两个监考,考试提供一张答题卡、一份7页的试卷、一张稿纸。感觉好久都没有体验这样正规的考试了,上一次还是2年前吧,这样的氛围让人觉[……]

>> 阅读全文…

Problem 35 Circular primes

Problem 35: Circular primes

https://projecteuler.net/problem=35

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.

There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.

How many circular[……]

>> 阅读全文…

Problem 34 Digit factorials

Problem 34: Digit factorials

https://projecteuler.net/problem=34

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.

Find the sum of all numbers which are equal to the sum of the factorial of their digits.

Note: As 1! = 1 and 2! = 2 are not sums they are not included.

分析

一个数等于它各位数字阶乘的和。[……]

>> 阅读全文…

Problem 33 Digit canceling fractions

Problem 33: Digit cancelling fractions

https://projecteuler.net/problem=33

The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cancelling the 9s.

We shall consider fractio[……]

>> 阅读全文…

Problem 32 Pandigital products

Problem 32: Pandigital products

https://projecteuler.net/problem=32

We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.

The product 7254 is unusual, as the identity, 39 × 186 = 7[……]

>> 阅读全文…

Problem 31 Coin sums

Problem 31: Coin sums

https://projecteuler.net/problem=31

In the United Kingdom the currency is made up of pound (£) and pence (p). There are eight coins in general circulation:

1p, 2p, 5p, 10p, 20p, 50p, £1 (100p), and £2 (200p).

It is possible to make £2 in the following way:

1×£1 + 1×50p + 2×20[……]

>> 阅读全文…

Problem 30 Digit fifth powers

Problem 30: Digit fifth powers

https://projecteuler.net/problem=30

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:

  • 1634 = 14 + 64 + 34 + 44
  • 8208 = 84 + 24 + 04 + 84
  • 9474 = 94 + 44 + 74 + 44

As 1 = 14 is not a sum it is not included.

The[……]

>> 阅读全文…

Problem 29 Distinct powers

Problem: Distinct powers

https://projecteuler.net/problem=29

nsider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:

  • 22=4, 23=8, 24=16, 25=32
  • 32=9, 33=27, 34=81, 35=243
  • 42=16, 43=64, 44=256, 45=1024
  • 52=25, 53=125, 54=625, 55=3125

If they are then placed in numerical order, with any re[……]

>> 阅读全文…

Problem 28 Number spiral diagonals

Problem 28: Number spiral diagonals

https://projecteuler.net/problem=28

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:

It can be verified that the sum of the numbers on the diagonals is 101.

What is the sum of the numbers on the d[……]

>> 阅读全文…

Problem 27 Quadratic primes

Problem 27: Quadratic primes

Euler discovered the remarkable quadratic formula:

n² + n + 41

It turns out that the formula will produce 40 primes for the consecutive integer values 0 <= n <= 39. However, when n = 40, 40² + 40 + 41 = 40(40+1) + 41 is divisible by 41, and certainly when n = 41, 4[……]

>> 阅读全文…

Problem 26 Reciprocal cycles

Problem 26: Reciprocal cycles

https://projecteuler.net/problem=26

分析

1/6 = 0.1(6) 表示0.16666…,拥有 1 位数字的重复周期

1/7=0.(142857) 拥有6位的重复周期

找到d < 1000, 1/d 拥有最长重复周期的数字。

方法1 模拟1/n的实际计算过程,记录下商的每一位,判断有没有出现重复

方法:模拟1/n的实际计算过程,具体的为div(n)函数。详细说明如下:

使用 div(n) 函数返回 1/n 的重复周期 和 1/n 的商(可选)
模拟了实际的 1/n 的计算过程,除数始终为[……]

>> 阅读全文…

Problem 25 1000-digit Fibonacci number

Problem 25: 1000-digit Fibonacci number

The Fibonacci sequence is defined by the recurrence relation:

Fn = Fn−1 + Fn−2, where F1 = 1 and F2= 1.

Hence the first 12 terms will be:

  • F1 = 1
  • F2 = 1
  • F3 = 2
  • F4 = 3
  • F5 = 5
  • F6 = 8
  • F7 = 13
  • F8 = 21
  • F9 = 34
  • F10 = 55
  • F11 = 89
  • F12 = 144

The 12th term, F12, is the[……]

>> 阅读全文…

华为机试感悟

前天接到通知,今天下午去滨江参加机试,1点钟开始,到滨江还早,却赶了很长一段路才压着点到了华为的机房。机房倒挺干净明朗的,里面整齐的一排排显示器,机器性能也还过的去,至少我用的那台还不错。机子只装了一个VC6.0,虽然这是事先已经知道的,但仍觉得使用过程会不习惯,一则已经很久不用VC了,追求轻便时就用CodeBlocks,想要调试功能强大时,就用VS2010,二则自己常用的IDE,不但本身提示功能齐全,而且我还装了VA,敲起代码感觉如鱼得水,轻快愉悦啊。不过,坦诚的说,一个不卡的机器,一个还算熟悉和强大的编译器,能提供这些,就很好很满足了,但是后面的编码过程,自己敲的确很happy,不间断的啪[……]

>> 阅读全文…